Blog Engine on multilingual site not working with friendly_id #359

jumichot opened this Issue Nov 27, 2013 · 1 comment


None yet

2 participants


I'm new to refinery and I have a problem on a multilingual site using refinerycms-blog with two locales : ":fr" and ":en".

I have a local picker on front end to switch local so I expect all these following links redirect to the same post.

By id it's ok for both languages I get the right content :

By slug it's ok if the slug is in the right local:
In French ->

In English ->

But my problem is when I whant to switch locale with one of these links : : this one work, I get the content in french
But this one doesn't work:

I get an ActiveRecord::RecordNotFound :

ActiveRecord::RecordNotFound in Refinery::Blog::PostsController#show
Couldn't find Refinery::Blog::Post with id=mon-premier-article [WHERE `refinery_blog_post_translations`.`locale` = 'en']

My first question is: it is the normal behaviour ? When I use my locale switcher on refinery pages I'm redirect to the right slug
/fr/a-propos become /en/about after the reload of the page

I suspect a problem with friendly_id or globalize, here my gemfile

source ''
ruby '2.0.0'
gem 'rails', '3.2.15'

gem 'jquery-rails'
gem "globalize3", "0.3.0"
gem "foreman"

gem 'refinerycms', '~> 2.1.0'
gem 'refinerycms-acts-as-indexed', '~> 1.0.0'
gem 'refinerycms-blog', '~> 2.1.0'
gem 'carrierwave'
gem 'mini_magick'

group :development, :test do
  gem 'sqlite3'

group :production do
  gem 'pg'

group :development, :production do
  gem 'unicorn'
  gem 'asset_sync'
  gem 'fog'
  gem 'unf'

group :development do
  gem 'quiet_assets'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'

group :development, :test do
  gem "rspec-rails", "~> 2.14.0"

And my i18n.rb file in the refinery intializer

# encoding: utf-8

What do you think ?
# encoding: utf-8

Refinery::I18n.configure do |config|
  config.default_locale = :fr

  config.current_locale = :fr

  config.default_frontend_locale = :fr

  config.frontend_locales = [:fr,:en]

  config.locales = {:en=>"English", :fr=>"Français"}

And the first lines of the trace

activerecord (3.2.15) lib/active_record/relation/finder_methods.rb:344:in `find_one'
friendly_id ( lib/friendly_id/finder_methods.rb:17:in `find_one'
friendly_id ( lib/friendly_id/globalize.rb:107:in `find_one'
activerecord (3.2.15) lib/active_record/relation/finder_methods.rb:315:in `find_with_ids'
activerecord (3.2.15) lib/active_record/relation/finder_methods.rb:107:in `find'
refinerycms-blog (2.1.0) app/helpers/refinery/blog/controller_helper.rb:8:in `find_blog_post'
activesupport (3.2.15) lib/active_support/callbacks.rb:462:in `_run__2633836395712304448__process_action__1521493722014838462__callbacks'
activesupport (3.2.15) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.15) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.15) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.15) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.15) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.15) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.15) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.15) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.15) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.15) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.15) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.15) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.15) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.15) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.15) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.15) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.15) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.15) lib/action_dispatch/routing/route_set.rb:73:in `call'

I had already run bundle update. I have friendly_id (, globalize3 (0.3.0), and rails (3.2.15) in my Gemfile.lock

Refinery member

The pages extension has, I believe, support built in to detect the improper language and redirect it. It's simply not present in the blog extension.

@parndt parndt closed this Aug 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment