ERB
(ERB)
1
I am a new to rails so this is probably a basic question.
I have a resource route as such:
resources :user_profiles
In one of my controllers, I have the following:
redirect_to user_profiles_path(4)
This redirects to the "show" action in the "user_profiles" controller,
but the url structure is: http:/mydomain/user_profiles.4
Why is the url .4 and not /4?
Any help would be appreciated!
If you want to redirect to a specific user_profile, you probably want to use the singular helper:
user_profile_path(4)
The singular path accepts 2 arguments: id and format
The plural helper (user_profiles_path) is for the “index” action and only accepts 1 argument: format
Run rake:routes to take a look at the available URLs and their helpers.
ERB
(ERB)
4
Thanks Tim! That did the trick!
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Tim Shaffer