mardi 21 juin 2016

Rails 3 upgrade to Rails 4 url_for no longer working, need to call ActionView::RoutingUrlFor#url_for?

I'm in the process of upgrading an existing application from Rails 3 to Rails 4. I have an internal gem that needs to use the url_for gem to return URLs for a form that will be rendered.

In Rails 3 I was accomplishing this using

@template.url_for(:controller => '/foo', :action=> 'bar')

In Rails 4 this ends up using a generic method that really does nothing and actually raises an exception if passed a hash.

It appears the real logic of the old url_for has moved into ActionView::RoutingUrlFor#url_for, but I'm not sure how I can call this from outside the view now?

Aucun commentaire:

Enregistrer un commentaire