i trying make simple button redirect user own user page.
here button on application.html
<li><%= link_to "my profile", {:controller => "users", :action => "show", :id => session[:user_id] }, :method => "get" %></li>
controller show method left blank
def show end private # use callbacks share common setup or constraints between actions. def set_user @user = user.find(params[:id]) end
here route
match '/myprofile', to: 'users#show', via: 'get'
i feel missing simple, regardless, appreciated. thanks
when click profile button, @user = user.find(params[:id]) highlighted.
what log say? show (a) action getting called , (b) parameters being sent in.
could simple params[:id]
being either wrong id
, ornil
reason.