hey,
i have found your post about filter function with parameters:
Hi!
I want to add a function with a static paramter ("2" in the example)
to
a filter, but somehow Rails seems to be looking for another syntax.
before_filter :check_quantity(2), :only => [:show]
doesn''t work. What''s the right way to do this?
Thanks a lot!
---------------------------------
Can u help me with this??
i have this code in a module file. (module LoginSystem)
def module_backend_required(the_module = "test",the_action =
"test")
p "-----------------------"
p "the_module" + the_module
p "the_action" + the_action
p "-----------------------"
if not protect?(action_name)
return true
end
if @session[:backend] and authorize?(@session[:backend])
return true
end
# store current location so that we can
# come back after the user logged in
store_location
# call overwriteable reaction to unauthorized access
access_denied
return false
end
an user has a role, and a role has many modulepermissions
like module: books , actions: create, read, edit, .....
in my controller i have this
before_filter
:module_backend_required(''users'',''update''),
:only => [
:edit, :update ]
=>> syntax error on ''users'',''update''
when i do before_filter :module_backend_required(), :only => [ :edit,
:update ]
the controler prints
--------------------
the_moduletest
the_actiontest
--------------------
How can i get the 2 parameters? so i dont need to make a lot functions
for each module/action.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060824/3dc7a380/attachment-0001.html