Displaying 20 results from an estimated 82 matches for "after_filters".
Did you mean:
after_filter
2006 Feb 20
3
Rewriting with an after_filter
All -
I''m completely new to RoR and also new to programming in an MVC
structure...
The Pragmatic Programmers guide to Rails says, temptingly:
"After filters can be used to modify the outbound response, changing the
headers and content if required. Some applications use this technique to
perform global replacements in the content generated by the controller?s
templates (for
2006 May 11
1
rendering in after_filter
Hi!
Is it possible to render the action within the after_filter method, or
is the rendering performed before?
I have something like this:
class FooController
after_filter :send
def a
@content=...
end
def b
@content=..
end
protected
def send
send_data(@content,...)
end
end
However, when calling the action a or b, the @content doesn''t get sent,
but instead
2009 Jul 14
1
How to add after_filter-style render
Hello
I would like to execute specific action rendering something into page
after each of my ajax calls. In example I would like to update some
div or display an alert.
How I imagine it could work is as follows
class ApplicationController < ActionController::Base
after_filter :do_something_after_each_ajax_call
def do_something_after_each_ajax_call
if request.xml_http_request?
2006 Sep 22
6
Using after_filter to control rendering on actions
I have a common failure page that I may need to render to upon failing
some test that occurs in an after_filter method.
I''d like to use the after_filter to take over the control of the
rendering, like so:
def test_for_validity
some_boolean = my_test
return render(:action => ''disqualified'') unless some_boolean
@success_controller ||= controller_name
2006 Jul 22
0
how to apply before/after_filter to actionmailer
hi,
I want to perform some action before/after each email was delivered.
How can I apply before/after_filter to actionmailer?
Thanks.
Best Regards,
Zhenjian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060722/8f014133/attachment.html
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
2009 Feb 22
0
Using after_filter to remove image after render
Hi Everyone,
I tried doing this and it''s not working as I would expect it, but I''m
not sure if it''s even possible. I have an app that generates and image
on request and displays it to the user. To cut back on storage, and
some security, I''d like the app to receive the view request, render
the image, display it, then delete the file. I know this isn''t
2006 Aug 01
8
Decoupled observers for controllers?
In the Rails Recipes book the recipe "Keeping track of who did what"
explains how to do decoupled observing of models.
In my application I''d like to do a similar thing but watching the
controllers. For example, when somebody hits the login method of the
Security controller, I''d like to make a note of it. In this case I
could observe the User model and watch for
2006 Apr 25
2
Bug in Rails 1.1 implementation of before_filters
...uot;before_filters") instead of before_filters.
Similarly, use read_inheritable_attribute("included_actions") instead of
included_actions. This is bad because now my code is tied to an
implementation detail which would normally be hidden.
Incidentally, the same bug also occurs in after_filters and
excluded_actions.
Cheers,
Graham
--
Posted via http://www.ruby-forum.com/.
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial
that is sent to a web service. Here''s the code:
class MyController < ApplicationController
after_filter :post_to_webservice
def show
# show logic
end
def post_to_webservice
stuff = render_to_string :partial => ''stuff''
webservice_post(stuff)
end
I get a DoubleRenderError in the
2006 Mar 10
3
WML sites
Hi all
how to make a WML view for rails pages?
I''ve tried to create like:
<wml>
<card>
CONTENT
</card>
</wml>
but my phone says unsupported content type...
thanks
--
Posted via http://www.ruby-forum.com/.
2006 Jul 10
2
Mongrel caching
I am using mongrel to serve static as well as dynamic pages.
The static page''s controller contains the following line of code:
after_filter {|c| c.cache_page}
This code caches that page as a static html page that does not have to be
rendered form multiple files (the view and layout). I got the idea to do
this form the rails recipes book. It definitely cached the pages. Wen I
make
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:
2013 Feb 28
1
how to use before_filter to decrypt post data
hello, everybody.
in ror, we can add a after_filter to a controller.
def aes_encrypt
response.body = AesHelper.aes_encrypt(response.body)
end
after_filter :aes_encrypt
and all action''s repsonse int the controller can be encrypt.
and my question is , how to decrypt data use before_filter, or anything
else.
ex: i want to post json data to /usr/register, the json data is
2007 Feb 28
1
One page in app keeps rendering as text/plain
Here''s what I get from wget -S:
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 28 Feb 2007 15:52:06 GMT
Server: Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a
mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.4
FrontPage/5.0.2.2635.SR1.2 mod_ssl/2
.8.28 OpenSSL/0.9.7a
#<#<Class: 0x2a96d0b978>:0x2a96d0b928>Content-Type:
2006 May 25
5
Is there a way to abstract the updating of other parts of the page after an Ajax request without putting using the standard view file?
Hey all,
I''d like to abstract the process of updating different portions of the
page after an Ajax request has taken place. Rather than simply putting
the extra view logic in the standard rjs template, it seems to give
better separation if there is a split between the core view logic (ie,
inserting a row in a table), and updating any associated portions of
the page.
Is this possible? I
2006 Apr 14
2
Puzzled with filters
Hello everyone!
I''m trying to create an after filter for all my actions in all
controllers. I put it in application controller (application.rb).
class ApplicationController < ActionController::Base
after_filter :tidyit
def tidyit
xxxx # syntax error - intentionally
end
end
I have a Example (example_controller.rb) controller with index action.
class
2005 Nov 03
9
[Idea] session-wide persistent variables
I was thinking about having instance variable stored and fetched from
session container automatically before calling an action and after the
action is finished. Using methodology of accessors it would look like:
class MyController < ActionController::Base
persistent_attr :person
def alfa
person = ''John Smith''
# render as usual view alfa.rhtml with anchor
2007 Dec 23
5
prepend_view_path not working
Now that controllers can have multiple view paths I''ve been playing with
themes over the weekend. Running into a view issues. I have a
before_filter in the ApplicationController that calls prepend_view_path
to add the path of my theme. I even log the view_paths in an
after_filter to make sure it made it all the way through. The output
looks something like:
2006 Feb 09
6
Getting the name of the calling controller
I know I''ve seen this before, but I can''t find it and Google hasn''t
been a help...
>From within a controller method, how can I find the name of the
requesting controller? For example, if I''m in controller C1 and I do
a
redirect_to :controller=> ''foo'', :action => ''bar'',
how can I find the name of the requesting