Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODEL:
- class Book < ActiveRecord::Base
- translates :label
- end
- MIGRATION:
- class CreateBooks < ActiveRecord::Migration
- def self.up
- create_table :books do |t|
- t.string :name
- end
- Book.create_translation_table! :name => :string
- end
- ...
- I18n.locale = :en
- book = Book.new
- book.name "Hello"
- book.save!
- I18n.locale = :pl
- book.name "Witaj"
- book.save!
- What's in the books table? THE LAST SAVED VALUE! :(
- So, every new added translation will overwrite original table values.
- Is it a bug or a feature?
Add Comment
Please, Sign In to add comment