diff options
Diffstat (limited to 'railties/lib/rails/generators/generated_attribute.rb')
-rw-r--r-- | railties/lib/rails/generators/generated_attribute.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb index a8f7729fd3..e801ab0c90 100644 --- a/railties/lib/rails/generators/generated_attribute.rb +++ b/railties/lib/rails/generators/generated_attribute.rb @@ -74,6 +74,7 @@ module Rails when :datetime, :timestamp then :datetime_select when :date then :date_select when :text then :text_area + when :rich_text then :rich_text_area when :boolean then :check_box else :text_field @@ -82,15 +83,15 @@ module Rails def default @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 name == "type" ? "" : "MyString" - when :text then "MyText" - when :boolean then false - when :references, :belongs_to then nil + 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 name == "type" ? "" : "MyString" + when :text then "MyText" + when :boolean then false + when :references, :belongs_to, :rich_text then nil else "" end @@ -152,6 +153,14 @@ module Rails type == :token end + def rich_text? + type == :rich_text + end + + def virtual? + rich_text? + end + def inject_options (+"").tap { |s| options_for_migration.each { |k, v| s << ", #{k}: #{v.inspect}" } } end |