similar to: before_filter: how to give :except more than 1 value?

Displaying 20 results from an estimated 4000 matches similar to: "before_filter: how to give :except more than 1 value?"

2006 Jul 14
4
sending additional parameters to before_filter
i am trying to create a system so that different users have different priviliges on my application. i was going to modify my authorize function so that i could pass the required role to it and have it check the current user for that role. i am using before_filter and would like to have just one function instead of writing one for each role like so: authorize(role) instead of:
2006 Jan 30
5
Functional tests and dealing with login before_filter
Hi all, I''m curious as to how you do functional testing on the controllers if, within the ApplicationController, I have a before_filter :authorize, :except => :login, where the private authorize method checks for session[:user]. I can''t do "post :login", because that method is in a different controller. I tried setting session[:user] directly in the setup
2006 Feb 20
1
Using :except or :only on a before_filter block
Hi all, How do you use :except or :only conditions on a filter block? I can''t seem to work out the syntax! I''m currently doing: before_filter { |c| c.role_required ''admin'' } Thanks a lot! Tom
2006 Feb 04
22
What''s the best way to embed a form?
I would like to embed my login form on my app''s home page. What''s the best way to render the login action of member controller from another action? Thanks Frank --------------------------------- Relax. Yahoo! Mail virus scanning helps detect nasty viruses! -------------- next part -------------- An HTML attachment was scrubbed... URL:
2008 Jun 13
3
before_filter order of execution
Hi I''m trying to use before_filter to allow access to a site. Only logged in users can view any object in the controller, but only users with a access_level higher than 2 can view specific objects. My code is: ----------------------------------------------------------- IN USER_CONTROLLER before_filter :login_required before_filter :access_granted, :only => [:destroy, :new , :edit]
2006 Apr 21
8
web services and dealing with before_filter
Hi all, I''ve got a Rails app with a ApplicationController that looks like this: class ApplicationController < ActionController::Base before_filter :authorize, :except => :login def authorize unless session[:user] flash[:notice] = "Please log in" session[:jumpto] = request.parameters redirect_to :controller =>
2006 Aug 02
3
Need help with registration page
I have most of my books open as I''m trying to create this app. Still not sure how to make this work - hopefully some help / hints can get me further. First I used the "authorizing users" recipe from Rails Recipes. Though I did add some more generic type of registration fields (email, address, etc). I want the registration form on the main page(index) of the site. What I have
2008 Jan 30
1
Can before_filter using Proc and specify block ?
Hi, I see from this post http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/97e333daab05b725/8252c90cb9c36f6d?lnk=gst&q=passing+parameter+before_filter#8252c90cb9c36f6d it can specify the Proc in the before_filter function, but when specify when action apply this filter, it raise an syntax error, such as rthe following code before_filter {|controller|
2006 May 16
2
before_filter and the application controller
Hi there, I''m having a bit of an issue with my before_filter. I know that the filters put in the application.rb controller are global for all the controllers. In my application filter I''d like to allow access to the RSS feed method in a ''member'' controller and skip the login checks that the before_filters are currently performing. In my application my filters
2007 Dec 03
2
before_filter application => exclude some other controllers
Hello again, It''s possible to use before_filter in the application_controller, and exclude for some methods from other controllers ? i have a before_filter in application_controller that checks if the user is logged, if the time hasn''t expired, ... and I want to exclude some methods of this check, like the login. This ''login'' belongs to other controller. I
2006 Feb 27
3
Send parameter along with method in before_filter
Hello list, I have an app that has a very simple authorization scheme. A person can have many roles and roles can have many people. In my app, I''d like to do before_filter :login_required (since no role name is provided, it accepts any users with credentials) before_filter :login_required ("administrator") (only accepts those with role administrator) before_filter
2009 Mar 05
4
before_filter :action_name OR :action_name
Hi there I am wondering if we can use before_filter in the form of :action OR :action what i want to do is to implement one of the actions, if the first failed, then go to the second when i use before_filter :action1 before_filter :action2 each method will run them, my case is that i want to check if one of them is true and not both any idea?
2006 Jul 26
5
Restricting before_filter to certain actions?
Can you restric before_filter to specific actions? -- Posted via http://www.ruby-forum.com/.
2006 Mar 10
3
before_filter question
Let''s say I''m using before_filter in my controller: before_filter :setup def setup # do something here end Is there any way my setup method can know which action is really about to be called? Let''s say I want to log out which action is going to be called, how can I know that in the before_filter method? (My question is not really about logging,
2008 Oct 25
1
Returning a variable to before_filter
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
2007 Mar 20
1
Passing Arguments to before_filter
I want to put a before_filter in application.rb, as follows: before_filter :do_something, :except_controller => [:admin] def do_something(options) options.stringify_keys! unless options[:except_controller].include?(controller_name) # do something useful end end Where I''m blocking is on how to get the ''options'' data in the do_something method. I think I
2006 Apr 17
2
newbie before_filter question
I''ve successfully gotten acts_as_authenticated working. Currently the before_filter line for my admin screen is like this: class AdminController < ApplicationController include AuthenticatedSystem before_filter :login_required Only issue I have now is that anyone logged in can access that screen. I''d like to differentiate between a regular user and
2006 Mar 30
1
flash, before_filter and redirect_to
I leave a notice in the flash and do a redirect from a before_filter. Can someone confirm that the first request after this, i.e. the page I redirect to, doesn''t/isn''t supposed to clear the flash? -- View this message in context: http://www.nabble.com/flash%2C-before_filter-and-redirect_to-t1367103.html#a3665933 Sent from the RubyOnRails Users forum at Nabble.com.
2006 Jul 18
6
before_filter chains and halting at an arbitrary filter
Hi--I''m trying to implement a 2-level authentication system, where I have one before_filter which does general user authentication, and another which does further authorization for a specific controller. I have it set up as follows: before_filter :authorize_level_2 prepend_before_filter :authorize_level_1 which causes authorize_level_1() to run, and then authorize_level_2().
2006 May 25
5
Setting a global before_filter action in application.rb
Can you set a global before_filter action in application.rb? So, for example, you could control authentication for all of the controllers in an app.? Obviously, you would need a way to reference actions by controller within this "global before-filter". Thanks, Wes -- Posted via http://www.ruby-forum.com/.