Reputation: 15491
Im trying to figure out a most basic feature, to create a named route that I can include in my views and code but am unable to get it to work
match '/user/:username' => "profiles#show", :as => show_profile
How would I be able to include in my views below code:
show_profile_path
and have it linked to /user/username ( of the user logged in ) Im using devise and rails 3.2 and searched upfront for this
Upvotes: 1
Views: 521
Reputation: 131
try this:
link_to "cool profile", show_profile_path(username: @user.username)
be sure that you have right search method in Profiles_controller#show
@user = User.where(username: params[:username]).first
Upvotes: 2