Reputation: 810
I created a new route and a corresponding method in a controller and view:
get "pictures/user/:username" => 'Pictures#user'
def user
@pictures_user = User.where(username: params[:username]).first
render 'user.html.erb'
end
Just some simple html/erb
I get this following error. I know the user method is being entered, seems to be a problem rendering the view?
Routing Error
No route matches {:controller=>"pictures", :action=>"user", :username=>"my_username", :page=>nil}
What am I missing?
Upvotes: 0
Views: 2129
Reputation: 1102
user.html.erb is inside the same directory of views/pictures? just do
render 'user'
should be fine i think
and I guess your Pictures downcase will be better @@
get "pictures/user/:username" => 'pictures#user'
Upvotes: 2