I have a controller which has a method called history
class UsersController < ApplicationController
def history
User.return_history(params[:id])
end
end
I have the following in my routes.rb file
map.resources :users, :shallow => true do |user|
user.resources :friends, :shallow => false
user.resources :posts, :collection=>{:no_access => :get}
user.resources :photos
end
How do I try to Ajax call the history method of the users_controller.rb
? Using link_to_remote
in the following way
link_to_remote 'History', :url=>history_user_path(@user), :update=>"history", :method=>'get'
throws me an error saying history_user_path()
not found. How can this be? edit_user_path()
shows no error and edit is not even explicitly defined in the User.rb file. Thanks.