Advice for Rspec #26

Closed
astjohn opened this Issue Jun 8, 2013 · 2 comments

Comments

Projects
None yet
3 participants
@astjohn
Contributor

astjohn commented Jun 8, 2013

Thanks for this gem. It's awesome.

After setting things up with the defaults, all of my controller and route specs exploded. The errors produced all have to do with the routes not being found.

Does anyone have any advice on this? I've seen some posts on SO about monkey patching here and there, but those approaches don't seem to be working out for me.

Note that setting:

RouteTranslator.config do |config|
  config.generate_unlocalized_routes = true
end

solves this issue. However, when I do this the urls generated fallback to the default locale. For example, my routes file is something like:

localized do
    resources :cars, only: [:index, :show]
end

and my link would be something along the lines of:

= link_to car.make, car

In this situation, visiting /fr/voitures should have produced the french routes, such as /fr/voitures/toyota but they fall back to /cars/toyota. This was unexpected behaviour. I thought it would have generated the french url in this situation given the french scoping and fall back only when necessary. This behaviour does not occur when the config setting is false. Having the gem generate the unlocalized routes but not fall back immediately when generating the urls would solve everything for me.

Any advice is appreciated. Thanks!

@waiting-for-dev

This comment has been minimized.

Show comment Hide comment
@waiting-for-dev

waiting-for-dev Jun 30, 2013

Same here. Finally I add to each ' get' method the locale, but it's not the best solution at all.

Thanks for this gem :)

Same here. Finally I add to each ' get' method the locale, but it's not the best solution at all.

Thanks for this gem :)

@tagliala

This comment has been minimized.

Show comment Hide comment
@tagliala

tagliala Jan 18, 2016

Collaborator

Closing here, I don't know if this is still an issue

Collaborator

tagliala commented Jan 18, 2016

Closing here, I don't know if this is still an issue

@tagliala tagliala closed this Jan 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment