Sha256: d931db10389c0108d3809e04f3dfbc61fdf0c5617a594b49344e08baa5c9ff07

Contents?: true

Size: 674 Bytes

Versions: 19

Compression:

Stored size: 674 Bytes

Contents

class <%= migration_class_name %> < <%= activerecord_migration_class %>
  def change
<% attributes.each do |attribute| -%>
<% I18n.available_locales.each do |locale| -%>
<% column_name = Mobility.normalize_locale_accessor(attribute.name, locale) -%>
<% if connection.column_exists?(table_name, column_name) -%>
<% warn "#{column_name} already exists, skipping." %>
<% else -%>
    add_column :<%= table_name %>, :<%= column_name %>, :<%= attribute.type %><%= attribute.inject_options %>
    <%- if attribute.has_index? -%>
    add_index  :<%= table_name %>, :<%= column_name %><%= attribute.inject_index_options %>
    <%- end -%>
<% end -%>
<% end -%>
<% end -%>
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mobility-0.5.1 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.5.0 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.4.3 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.4.2 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.4.1 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.4.0 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.6 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.5 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.4 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.3 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.2 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.1 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.3.0 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.2.3 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.2.2 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.2.1 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.2.0 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.1.20 lib/rails/generators/mobility/templates/column_translations.rb
mobility-0.1.19 lib/generators/rails/mobility/templates/column_translations.rb