Reputation: 570
NameError in HomeController#index
undefined local variable or method `load_and_authorize_resource' for #<HomeController:0x3136e00>
Rails.root: D:/RailsInstaller/Ruby1.9.3/dynacan-master
I am new in Ruby On Rails, & I'm trying to implement the role in my app where I got the above error. please assist me out of this error & give me other alternate. ASAP
Thanks
Upvotes: 1
Views: 3226
Reputation: 4831
I have seen a similar error with the cancan gem
If you're using the gem cancan, and you have load_and_authorize_resource
in your HomeController
, it's trying to load the Home
model which doesn't exist. Instead, trying using authorize_resource class: false
, so
class HomeController < ApplicationController
authorize_resource class: false
# rest of your code
end
For more information on using cancan on non RESTful controllers, see the Wiki specifically about it
Hope this helps
Upvotes: 3