search for: around_filter

Displaying 16 results from an estimated 16 matches for "around_filter".

2006 Apr 03
4
Clearing out filters in ActionController
I want to run a single filter in my application.rb file, and then if a certain condition is true, end the action''s processing immediately. Right now I''m using prepend_before_filter to ensure that it gets run first, but some of my around_filters are still being processed. Is there a way that I can clear out all the filters that should be run? Basically it''ll look something like this: class ApplicationController < ActionController::Base prepend_before_filter :check_domain def check_domain unless valid_site? re...
2010 Jan 27
1
around_filter and with_scope
...k that enforce a simple spec: normal user should read/write information only about their group''s users, but "admin" users can read/write about all users. The other controller is quite similar, just on another model. trying to refactor a was reading about using a with_scope in an around_filter. this seems to work and the code gets a lot smaller. But it seems to be a deprecated practice... What is the "rails way" to accomplish this? thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,...
2006 Mar 21
0
cache and exception safe around_filter (after_filter)
Hi, I was wondering if there is a feature or construct in rails that is guaranteed to run after an action like an around_filter (or after_filter) but will still run regardless of a broken filter chain or thrown exception? Currently I have an around filter setup, and I really require the after part of the filter to run, although if the filter chain is broken via cacheing or an exception is throw, the code is skipped. S...
2007 Apr 23
0
request logging: around_filters can't see error responses!
...75cb RESPONSE_BODY_SIZE: 7001 REMOTE_IP: 127.0.1.1 TIMESTAMP: 2007-04-23 12:05:41.555780 -07:00 USER_AGENT: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/ 20060601 Firefox/2.0.0.3 (Ubuntu-edgy) USER_ID: 102 QUERY_STRING: PATH: /home IS_AJAX: false PARAMS: {} I tried doing this using an around_filter. The #before part stored the time and generated a request ID, and the #after part dumped all the remaining data from the controller.request and controller.response objects into this log. This worked great, except in the case that any error occurred. In this case, Rails would run my after filter...
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 @ticket.save redirect_to tickets_path else...
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/
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: Talk&quot...
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
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 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 = ?", current_user.get_business_id]}, :create => {:business_id => current_user.get_business_id},...
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
2008 Jun 24
0
scoped_access plugin and 2.0
...r/plugins/scoped_access/init.rb:18:in `alias_method'' undefined method `prepare_application'' for class `Class'' ( NameError ) from /home/httpd/rails/demoone/vendor/plugins/scoped_access/init.rb: 18:in `evaluate_init_rb'' ... It looks like I can replace its use in around_filter in my controllers with with_scope which has to be in the models. Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA...
2006 Jan 12
3
How to Selectively Quite SQL Logging
I know about logger.silence but here is the issue: I''m comfortable with the way the user engine is working, but it generates quite a bit of SQL noise in the logs. I''d like, for that engine, to suppress the SQL logging. Code in it has return statements in conditionals, e.g., if !user? RAILS_DEFAULT_LOGGER.debug "checking guest authorisation for
2009 Feb 02
2
did_not_yield
...required ''+session[:expires_at].to_s ) : (@login_info=''Updating session time'') yield ) : ( @login_info=''User not logged'') end ... end In my controllers, I have this called: class ScannsController < ApplicationController around_filter :log_test def ... end end When there''s no [:auth] in the session, I''m getting the did_not_yield error ... If I understand it correctly, first checks if there''s a user in the auth session: 1. there''s a user => checks if the session has expired or not. 1....
2006 Apr 09
1
PageSweeper not working since upgrading to 1.1.1
...b/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/caching.rb:541:in `callback'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/caching.rb:534:in `after'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:227:in `around_filter'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:227:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:401:in `call_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_contro...
2007 Jan 31
7
GET request works via curl, crashes from Java
...t subject line is of course a severe truncation!] I''ve got a REST request that works fine from curl but causes a mongrel error when executed from a Java program. This all worked with fine with rails 1.1.6 and webrick. I''m trying to update the app to rails 1.2.1 (I need working around_filters). I''m running in development mode with mongrel 1.01 running on macosx 10.4.8 w/ruby 1.8.4, rails 1.2.1. When I do the following request with curl everything appears to work fine: curl -I -X GET -H ''Accept: application/xml'' http://localhost:3000/1/offering/84/bundle/...