Class: Rails::Generator::GeneratedAttribute
- Inherits:
-
Object
- Object
- Rails::Generator::GeneratedAttribute
- Defined in:
- lib/dry_generator.rb
Instance Method Summary collapse
Instance Method Details
#default_for_factory ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/dry_generator.rb', line 181 def default_for_factory @default ||= case type when :integer then 1 when :float then 1.5 when :decimal then '9.99' when :datetime, :timestamp, :time then 'Time.now' when :date then 'Date.today' when :string then '"Hello"' when :text then '"Lorem ipsum dolor sit amet..."' when :boolean then false else '' end end |
#default_for_fixture ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/dry_generator.rb', line 167 def default_for_fixture @default ||= case type when :integer then 1 when :float then 1.5 when :decimal then '9.99' when :datetime, :timestamp, :time then Time.now.to_s(:db) when :date then Date.today.to_s(:db) when :string then 'Hello' when :text then 'Lorem ipsum dolor sit amet...' when :boolean then false else '' end end |