Returning a variable to before_filter


#1

I know its probably doesnt sound right, but I am trying to call a
before_filter method that will check whats the user role and then
based on that return a string / hash / array to the before_filter

something like this:

class MonqiClassesController < ResourceController::Base
before_filter :check_user_access_level , grant_access

def check_user_access_level

if current_user.has_role?('staff')
 return grant_access = {:only  => :index}
end

end
end

i am planing on using case and then return the set of actions they can
preform

maybe there’s a better way or someone already saw that somewhere

thanks
Ami


#2

On 25 Oct 2008, at 23:57, Ami wrote:

def check_user_access_level

if current_user.has_role?(‘staff’)
return grant_access = {:only => :index}
end
end
end

i am planing on using case and then return the set of actions they can
preform

Sound like you just want to set an instance variable.

Fred