similar to: before_filter application => exclude some other controllers

Displaying 20 results from an estimated 4000 matches similar to: "before_filter application => exclude some other controllers"

2007 Nov 20
3
Plugin: can't call before_filter in ApplicationController
Hi all I want to outsource an extension for ApplicationController, that I had in application.rb so far, into a plugin. I have created this plugin, and in init.rb I load require File.dirname(__FILE__) + ''/lib/application_controller'' In lib/application_controller.rb I have the following code: class ApplicationController before_filter :prepare_user ... end This worked
2012 May 01
1
uninitialized constant LoginController in Ruby
This is my environment.rb # Load the rails application require File.expand_path(''../application'', __FILE__) # Initialize the rails application Qstack::Application.initialize! require ''koala'' This is my application_controller.rb class ApplicationController < ActionController::Base # protect_from_forgery before_filter :parse_facebook_cookies def
2008 May 06
12
Why before_filter is not working?
I have been scratching my head on this one for most of the day. Hopefully someone can help explain why before_filter isn''t working for my codes. In my Application controller, I have this: before_filter :login_required, :except => [:newacct, :create_newacct, :passwd_reset ] def login_required unless session[:user_id] flash[:notice] = "Please log in"
2010 Jul 05
1
[PATCH] gettext initiation problem Thanks to Thibault Deloffre <tdeloffre@linagora.com>
From: root <root at ovirt.admin.virt.par.lng> Signed-off-by: root <root at ovirt.admin.virt.par.lng> --- src/app/controllers/application_controller.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb index 4c4666e..c7f8431 100644 ---
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/.
2010 Mar 31
1
[PATCH] Upgrading the server to work with Rails 2.3.4.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- src/app/controllers/application_controller.rb | 2 +- src/config/environment.rb | 2 +- src/config/initializers/new_rails_defaults.rb | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
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
2008 Dec 19
2
before_filter for a specific controller/action
I''m learning about before_filter, implementing a simple "you must be logged on" thing. It works great, but I need to allow people to create a player as well. By writing the except as attached, that works, but then everyone has access to all "new" methods, which I don''t really want. Can someone help me with how to properly construct this to limit non-logged
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 Jul 25
5
webrick server slow or does not connect
hi, In login_controller.rb when I do the fallowing code it works fine before_filter :authorize, :except => :login but I want to do the fallowing when creating the user so the authorization is not checked before_filter :authorize, :except => :login, :except => :create_user but when I do this webrick server appear to be slow or not connected and take lot of time to load? Could someone
2008 Feb 22
7
Testing misc methods in ApplicationController
I''m already successfully testing before_filters in application_controller courtesy of this blog post: http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller However, i can;''t work out how to test the sort of method that is added to application_controller so that all controllers can use it. It must be something simple that i''m doing
2011 Feb 21
2
self.prepend_view_path - am I missing something
I have an app that varies its content based upon the domain from which it is being accessed. Some of the domain characteristics are supported in the model but it is easier varying static text in the views and then sharing the form templates via partials etc. Rails 2.3.10 and looking at the documentation at
2010 Jul 08
1
[Rails3] Issue in modifying locale and redisplaying page
In a test app, I have a drop-down selection to change the language of the site. I use an Ajax request to an action in which the locale is changed, and the it''s redirected to the home page unfortunately, the locale seems to be changed but the home page doesn''t reflect the new language .. application_controller.rb .. before_filter :set_locale def set_locale I18n.locale =
2010 Jul 02
6
making something available application wide
I''d like to display a banner on every page. Ultimately I''ll be tweaking which banner is displayed via different controllers but initially I''d just like to set a single banner application wide and display it in my "_header", a partial I include in all layouts. I''ve got a BannerAdvert model, simple. If I''m in my welcome controller index action
2006 May 11
1
skipping filters
I have a simple login scheme in application.rb. Something like :requires_login is called in any controller as a before_filter. All is good, except I''m having trouble figuring out how to make the public login actions skip this before filter. Here''s what I have: application.rb skip_before_filter :requires_login, :only => [:login, :logout, :confirm_valid_login]
2009 Oct 18
4
NoMethodError in User sessionsController#new
I''m setting up authentication with Authlogic and I get this error. I''ve done some searching but with no success. I tried setting the current_user method in Application_controller to protected and not private, on the recommendation in Stack Overflow. Error in browser----------------- NoMethodError in User sessionsController#new undefined method `require_no_user'' for
2006 Apr 23
2
Check if current route == some route
I have a before_filter in ApplicationController in which I want to check if the current location is the same as a certain route, so that I only redirect non-logged in visitors to the "join" page if they''re not on that page already. The code I came up with is a bit ugly: redirect_to join_url unless (@logged_in or action_name == "join") I''m pretty sure
2009 Sep 10
1
undefined method `protect_against_forgery?'
When I use plugin ''railstree'' (http://www.hashcode.eti.br/?p=91) as following code: node = Node.new :label => menu_item.name, :link_to_remote => { :base => self, :update => "container", :url => {
2011 Jul 13
14
Using timezone javascript to set Time.zone
I''ve got a javascript that provides me with the timezone for the client. I want to use this to set Time.zone so that all my times stored in the database are displayed in the timezone for the client. So really simplistically var timezone = jstz.determine_timezone().timezone Time.zone = timezone.olson_tz obviously this can''t be done. I''ve taken a look on the web and can
2006 Oct 09
1
restful authentication - filtering out login ??
i am unable to reach the login page when adding ''before_filter :login_required'' to the application controller. I HAVE added the following to my sessions controller ''before_filter :login_required, :except => [:new, :create, :destroy]'' I figured this would overload the app controller filter but i get this loop while it looks for sessions/new and isnt allowed