Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rails 4 compatibility #42

Open
terraplane opened this Issue · 14 comments
@terraplane

Looks like the gem doesnt work. Routes were translated but _path helpers doesnt work.

@Padchi

Someone who has come up with a solution for this?

@overallduka

This is a big problem, here meet dont work whit Rails 4, someone have solution ?

@erwin16

same issue... actually too bad , cannot upgrade any of y Rails 3 apps... all using translated routes ...
any idea where we should look at in the code ??

@erwin16

found a way to make it running w Rails 4, using send...
I changed all my path urls
portofolio_path( Portfolio.find_by_name('ceramics') )
to :
send("portfolio_#{I18n.locale}_path", Portfolio.find_by_name('ceramics')
obvioulsy I did it because I need to upgrade an existing app.... I'll try to avoid this gem in future localized apps

@dgilperez

+1

Is this gem still supported?

@GSI
GSI commented

+1

Note that I am trying to migrate to route_translator (http://github.com/enriclluelles/route_translator). It seems to work in production, but in test any _path or _url calls without explicit language code also cause NoMethodError: undefined method 'foo_path' ...

I'll keep you updated.

@jdurand

+1

@GSI

Error still persists in Rails 4.0.2.

@GSI GSI referenced this issue from a commit in GSI/rails-translate-routes_reproduce_issue-42
GSI2014 reproduced error with 'rails-translate-route' as outlined in francesc… 877e6d5
@GSI

I published a Rails 4.0.2 project that reproduces the error:
https://github.com/GSI/rails-translate-routes_reproduce_issue-42

When you check it out and run "rake test", you should see the same error as shown in the README.

When removing the line starting with "ActionDispatch::Routing::Translator" from config/routes.rb, the "rake test" command succeeds.

@hugopeixoto hugopeixoto referenced this issue from a commit in hugopeixoto/rails-translate-routes
@hugopeixoto hugopeixoto Attempt at fixing francesc#42 e1f85f4
@hugopeixoto

I attempted to solve the problem.
The helpers are still not accessible from the tests, but they should be accessible from controllers and views. Hopefully this is enough.

Can someone check if it works, of if I broke something else?
https://github.com/hugopeixoto/rails-translate-routes/tree/issue-42

EDIT:
By the way, using my patch, I can successfully use the helpers in tests using:
Rails.application.routes.url_helpers.new_user_path
I will try to see if it is easy to fix that too.

@GSI

Note that @pebiantara (https://github.com/pebiantara/rails-translate-routes) solved the problem, but Rails 3 compatibility was lost in the process.

Sorry for being late providing that info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.