Resource Assistants in rails Console

As stated at http://guides.rubyonrails.org/routing.html , creating an inventive route will also bring up a number of helpers for the controllers in the application. For example, the resourceful resources :photos route will provide helpers such as photos_path, new_photo_path, etc. Now I can call the helper in the rails console with a helper object, for example helper.link_to "this", "that" . But calling helper.photos_path in the rails console does not work, however, these helpers are available in the controller. Why is this so?

thanks

+4
source share
1 answer

route helpers are available in the app object, so you can access them this way

 app.photos_path # => "/photos" 
+6
source

All Articles