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
176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/dry_generator.rb', line 176 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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/dry_generator.rb', line 162 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 |