diff options
author | Chris Oliver <excid3@gmail.com> | 2019-03-28 09:16:47 -0500 |
---|---|---|
committer | Chris Oliver <excid3@gmail.com> | 2019-03-28 23:58:33 -0500 |
commit | 19a29c6556a53b7258bfbfb6164dff344649b331 (patch) | |
tree | a5998e2fbdf03dffc6be6aef12a37061cb806c54 /activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt | |
parent | 0223665c971b98fe0ac82b78b485ee1330d4c1e3 (diff) | |
download | rails-19a29c6556a53b7258bfbfb6164dff344649b331.tar.gz rails-19a29c6556a53b7258bfbfb6164dff344649b331.tar.bz2 rails-19a29c6556a53b7258bfbfb6164dff344649b331.zip |
Add rich_text field to model generators
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt index 481c70201b..c07380bec9 100644 --- a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt +++ b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.tt @@ -7,7 +7,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi <%- elsif attribute.token? -%> add_column :<%= table_name %>, :<%= attribute.name %>, :string<%= attribute.inject_options %> add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>, unique: true - <%- else -%> + <%- elsif !attribute.virtual? -%> add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %> <%- if attribute.has_index? -%> add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> @@ -21,7 +21,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi <%- attributes.each do |attribute| -%> <%- if attribute.reference? -%> t.references :<%= attribute.name %><%= attribute.inject_options %> - <%- else -%> + <%- elsif !attribute.virtual? -%> <%= '# ' unless attribute.has_index? -%>t.index <%= attribute.index_name %><%= attribute.inject_index_options %> <%- end -%> <%- end -%> @@ -37,7 +37,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi <%- if attribute.has_index? -%> remove_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> <%- end -%> + <%- if !attribute.virtual? %> remove_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %> + <%- end -%> <%- end -%> <%- end -%> <%- end -%> |