Sha256: 0bf0e17b0305a53409450993796742a2c98dcefc25cf85ab3e0a1fd35ed2d981

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

ActiveRecord::Schema.define(:version => 1) do
  create_table :users do |t|
  end

  create_table :products do |t|
  end

  %w[translations user_translations].each do |table|
    create_table table do |t|
      t.integer :translatable_id, :null=>false
      t.string :translatable_type, :limit=>40, :null=>false
      t.string :language, :limit=>2, :null=>false
      t.string :attribute, :limit=>40, :null=>false
      t.text :text, :null=>false
    end
  end
end

#create model
class User < ActiveRecord::Base
  translated_attributes :name, :table_name=>:user_translations, :nil_to_blank=>true
end

class Shop < ActiveRecord::Base
  set_table_name :products
  translated_attributes :shop_name
end

class Product < ActiveRecord::Base
  translated_attributes :title, :description
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
translated_attributes-0.5.5 spec/models.rb
translated_attributes-0.5.4 spec/models.rb
translated_attributes-0.5.3 spec/models.rb
translated_attributes-0.5.2 spec/models.rb
translated_attributes-0.5.1 spec/models.rb