similar to: Clearing out filters in ActionController

Displaying 20 results from an estimated 1000 matches similar to: "Clearing out filters in ActionController"

2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around filter. I have defined expectations on the model classes, and ideally, I would add a further expectation for the scope. Is this already possible in some way? How would I go about adding support a scope expectation? Michael -- Michael Schuerig mailto:michael at schuerig.de http://www.schuerig.de/michael/
2006 Jul 17
1
:create paramaters don''t get through (scoped_acces plugin)
Hi all, I''m wrestling with the scoped acces plugin to generate object access controll, but the :create params don''t seem to get through. :find works great. This is the code around_filter ScopedAccess::Filter.new(Service, :service_filter) layout "settings" protected def service_filter { :find => {:conditions => ["business_id =
2010 Jan 27
1
around_filter and with_scope
i got two controller (with restful actions) where my code is quite ugly and not very dry. every action looks quite like this: if @logged_user.has_role?("admin") User.find(params[:id) else @logged_user.group.user.find(params[:id]) this is a security check that enforce a simple spec: normal user should read/write information only about their group''s users, but
2006 Jul 02
11
Rails Plugin: meantime_filter for controllers (actions within blocks)
Hello, I just finished writing a plugin for Rails that I''m annoucing the first release here: meantime_filter. It is descibed at http://roman2k.free.fr/rails/meantime_filter/0.1.0/ rdoc/ (See the end of this message for getting it.) ABOUT THE PLUGIN It extends ActionController to add the functionnality of having filters run at the action call time. This new type of filter yields
2013 Sep 26
2
Login Problem
Hello All, I am getting a problem while login for inactive users. While login I am getting - Processing by Devise::SessionsController#new as HTML User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1 Redirected to http://localhost:3000/ Filter chain halted as :require_no_authentication rendered or redirected. Inactive users
2007 Feb 14
2
prepend_before_filter
I''ve got a couple of before_filters that need to run in a specific order. One does a redirect_to if a session variable isn''t set. The other does a find which will fail if the session variable isn''t set. So they need to run in that order. But prepend_before_filter doesn''t seem to be working as advertised. Anybody got any insight? I''m still running
2006 Apr 05
3
"partitioning" table access
Hopefully someone can give me some advice on how to approach this problem... I''m getting ready to start a large new project where several different organizations would be working with a lot of tables. Each table would have an organization_id field to signify which organization owns that record. Organizations would only be able to view/edit records they own. Potentially thousands of
2006 Jul 23
4
Anything like with_scope for ActionController?
There are areas of my application that "want" to use a url structure like domain/<human_readable_param>/<Module>/<Controller>/<Action>/<Id> Please note that the human readable parameter I need to inject is NOT related to the <id> being used by the action/controller pair. It''s identifying a container object whose contains are operated
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().
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in my application rhtml: before_filter :login_required around_filter :set_timezone around_filter :catch_errors Currently I have them commented out while rspec''in but I''ll need to add them in my specs. def create @ticket = Ticket.new(params[:ticket]) @ticket.user = current_user if
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the model name, and optionally some conditions, and it generates a paginated query for you. This gets to be very bad if you''ve got any custom queries. class Company < ActiveRecord::Base def complete_videos Video.find :all, :conditions => "company_id=#{id} AND status=''complete''", :order
2008 Sep 13
2
<meta http-equiv="refresh" content="5"/>
Do you know of any way for me to stick a meta tag in using a before_filter or after_filter or around_filter? <meta http-equiv="refresh" content="5"/> I have been trying to figure out out and just cannot make sense of it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Nov 01
17
So how can I rewrite my app without using with_scope?
So, I hear that with_scope is going to be deprecated. Which is a bit of a shame, given the stuff I''ve been writing recently. I have a CMS with multiple clients. A ''client'' is essentially a company, with multiple users. Content on the site belongs to a client - content could be messages, images, schedules, etc etc. People belonging to one client should not be able
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a sales controller. I have a document in hr tagged whitepaper and a differnent document in sales tagged whitepaper when I am in hr I see the hr document tagged with whitepaper and not the sale document (what I want). but if I click on the tag whitepaper I return two documents, hr and sales. I just want to return the hr document
2007 Oct 18
9
with_scope issue
I have the following code: class User < ActiveRecord::Base has_many :requests do def find_active(options = {}) with_scope :find => { :conditions => ["requests.active = ?", true] } do find(:all, options) end end end end Executing user.requests.find_active results in the following SQL: SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND (
2008 Mar 06
3
cache_sweeper
Hi, Why is cache_sweeper not a documented method? I was pretty sure it used to be, but I could be wrong. I can''t seem to find any information on it anymore in the online docs. As a side note, looking at the code for cache_sweeper it appears to only work with the :only option, not :except (ignores it)... what''s the reason for this? Thanks, Andrew
2006 Apr 01
1
STI with_scope on parent - bug or feature?
Hi, It seems that setting a with_scope on the parent class doesn''t do anything MyClass.with_scope(:find=>{:conditions=> ["somecol = ?", ''val'']}) do @ext_pages, @ext_rows = paginate :my_extended_class, { :per_page => 13 } end # this doesn''t generate WHERE somecol=''val'' In order for scope to work you have to call
2008 Sep 24
3
caches_page :if not executing (but caches_action :if) does
Hi folks - Seeing a weird problem and would love some help. It''s documented in http://pastie.org/278310 to be more readable. In short, I have a caches_page "action", :if => {stuff} but the :if is never being called - the action is just caching every time. (If I put a debugger call in the :if block, it never stops.) If I replace caches_page with caches_action, the if
2007 Aug 21
3
Eager Loading
is there a way to always eagerly load an associated object so that you don''t have to put :include into every finder? class Product <ActiveRecord::Base belongs_to :user #always load user when product is loaded end Product.find(1).user.login #1 query since user was loaded with the product, same as if i used :include but I don''t want to have to specify it everywhere.
2006 Sep 08
1
has_many relationship extensions and scoping rules
Hi all ! Is this supposed to work ? class Email < ActiveRecord::Base has_many :to, :class_name => 'Recipient', :conditions => "recipients.source = 'to'" do def create!(*args) with_scope(:create => {:source => 'to'}) do super end end def build(*args) with_scope(:create => {:source => 'to'}) do