Sha256: cce877e30f1cdda7e5f568df87ab1b55189e2f5632cab7d62b475c5e954f45d3

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 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.belongs_to :translatable, :null=>false
      t.string :translatable_type, :limit=>40, :null=>false
      t.string :language, :limit=>2, :null=>false
      t.string :translated_attribute, :limit=>40, :null=>false
      t.text :text, :null=>false
    end
    #add_index :translations, [:translatable_id, :translatable_type]
  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

1 entries across 1 versions & 1 rubygems

Version Path
teonimesic-translated_attributes-0.5.8 spec/models.rb