From d0c249af2a2e630ac993eb23a691ef996613b55f Mon Sep 17 00:00:00 2001 From: Adrien Coquio Date: Sun, 3 Jun 2012 21:37:41 +0200 Subject: Added i18n support to models through globalize3. * Added Post translation * Added Category translation * Use friendly_id globalize with category * Added migrate_data option on migrations for translations * Use Refinery locale instead of I18n * Refactored duplicate locale_picker partial * Removed useless .all call * Use presence instead if / blank? * Added with_globalize scopes when loading posts of one category * Use Globalize when creating post factory * Fix failing specs by creating blog posts/categories using needed locale. --- db/migrate/20120530102901_create_blog_translations.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 db/migrate/20120530102901_create_blog_translations.rb (limited to 'db/migrate/20120530102901_create_blog_translations.rb') diff --git a/db/migrate/20120530102901_create_blog_translations.rb b/db/migrate/20120530102901_create_blog_translations.rb new file mode 100644 index 0000000..c301f42 --- /dev/null +++ b/db/migrate/20120530102901_create_blog_translations.rb @@ -0,0 +1,17 @@ +class CreateBlogTranslations < ActiveRecord::Migration + def up + Refinery::Blog::Post.create_translation_table!({ + :body => :text, + :custom_teaser => :text, + :custom_url => :string, + :slug => :string, + :title => :string + }, { + :migrate_data => true + }) + end + + def down + Refinery::Blog::Post.drop_translation_table! :migrate_data => true + end +end -- cgit v1.2.3