Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After creating a multi-language New Item, French version is no longer editable #153

Open
jcraigk opened this issue Oct 3, 2014 · 1 comment

Comments

@jcraigk
Copy link

jcraigk commented Oct 3, 2014

Let's say I have EN, FR, and DE setup as my locales. I can create all 3 translations just fine. However, if I go to edit the French version, upon Save I get

ActiveRecord::RecordNotFound (Couldn't find Refinery::News::Item with id=[slug])

I've tried changing order of locales as well as adding/removing French and other locales and it always has to do with French only. Even if French version contains no French-specific characters.

Why is ActiveRecord looking up the French News Items as id=[slug]?

@jcraigk
Copy link
Author

jcraigk commented Oct 21, 2014

I added a hack in my main Rails app to fix this. In /app/decorators/controllers/refinery/news/admin/items_controller_decorator.rb:

Refinery::News::Admin::ItemsController.class_eval do

  # Fix for "Couldn't find Refinery::News::Item with id=[slug]"
  # when editing certain translated news items (usually French)
  def find_item
    begin
      @item = Refinery::News::Item.find(params[:id])
    rescue
      @item = Refinery::News::Item.find(Refinery::News::Item::Translation.find_by_slug(params[:id]).refinery_news_item_id)
    end
  end

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant