Sha256: 74e61f0eb2014e42c7e2c281e3a33d77ae35f5967b2fdccf9db05b46d3678365
Contents?: true
Size: 1003 Bytes
Versions: 50
Compression:
Stored size: 1003 Bytes
Contents
class <%= migration_class_name %> < <%= activerecord_migration_class %> def change <% attributes.each do |attribute| -%> <%- if attribute.reference? -%> add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %> <%- elsif attribute.respond_to?(:token?) && attribute.token? -%> add_column :<%= table_name %>, :<%= attribute.name %>, :string<%= attribute.inject_options %> add_index :<%= table_name %>, [:<%= attribute.index_name %><%= attribute.inject_index_options %>, :locale], name: :<%= translation_index_name(attribute.index_name, "locale") %>, unique: true <%- else -%> 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 %>, :locale], name: :<%= translation_index_name(attribute.index_name, "locale") %> <%- end -%> <%- end -%> <% end -%> end end
Version data entries
50 entries across 50 versions & 1 rubygems