I’m using rails 3.1.3 (I believe the latest version) and in my app I am using the gem Devise for user auth. In order to add a user show (profile) page, I added a Users_Controller.rb
class UsersController < ApplicationController
before_filter :authenticate_user!
def show
@userProfile = User.find(params[:id])
@user = current_user
@title = @userProfile.name
end
end
and in the routes.rb file i have resources :users.
I also have a simple app/views/users/show.html.erb.
Now this all works fine and dandy when I manually go to localhost:3000/users/1 but, when I try to make a link to the profile <%=link_to "My Profile", user_path(@user) %> (This is in my applicationcontroller.rb incase that matters) I get an Action Controller: Exception No route matches {:action=>"show", :controller=>"users"}
BUT when i rake routes, action show and controller users show up. What am i doing wrong!!!
Please help!!
Instead of
do
However, doing that in
ApplicationControllerseems a bit strange. It should probably be in a view or layout file.