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. --- app/controllers/refinery/blog/posts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/refinery/blog/posts_controller.rb') diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index caa46ec..bb242fd 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -12,7 +12,7 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss? + (@posts = Post.live.includes(:comments, :categories).with_globalize) if request.format.rss? respond_with (@posts) do |format| format.html format.rss @@ -22,7 +22,7 @@ module Refinery def show @comment = Comment.new - @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? + @canonical = refinery.url_for(:locale => Refinery::I18n.current_frontend_locale) if canonical? @post.increment!(:access_count, 1) -- cgit v1.2.3