ruby on rails - undefined method current_user: Cancan and Active Scaffold -
i'm trying add action link active scaffold controller using
if current_user.can? :update, post config.action_links.add 'export', :label => 'export', :page => true end
but whatever controller try use, undefined method current_user
so, how can check if logged user can/cannot something?
i've tried
def ability @ability ||= ability.new(self) end delegate :can?, :cannot?, :to => :ability
as suggested here, without success.
what's wrong this?
current_user typically defined method, 1 must add. not supplied rails. so, need current_user method in applicationcontroller. there tons of examples @ authlogic example app on github
Comments
Post a Comment