Displaying 20 results from an estimated 2000 matches similar to: "Mongrel caching"
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
2006 Mar 22
0
page caching
I''m trying to use the following methods (extract):
expire_page :controller => "site", :action => "funding"
cache_page :controller => "site", :action => "welcome"
to rebuild my entire site cache from an admin page, but I can''t seem to get the cache_page function to work. looking at the docs there seem to be 2 versions of
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
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
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 Mar 01
3
Security issue: a user can fill cache with random urls
Say your app responds to : store/show/3 and caching is enable at the
store controller level.
A route says : map.connect ''store/:action/:id'', :controller => ''store''
All the following urls will be processed and cached (the cache
filling with ''page not found'' messages) !
store/foo/bar
store/show/090934298234897342
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 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
2005 Nov 11
0
cache_page throwing "undefined method merge" error
rails (0.14.2), OSX, webrick (right now - lighttpd in production)
I''m trying to cache pages with different file extensions and am having
a heck of a time.
This controller does nothing but display @cache.data (which can be XML or HTML)
Here''s the controller:
class DisplayController < ApplicationController
caches_page :xml, :html
session :off
def xml
@cache =
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
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 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
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 Aug 09
1
How to Disable Callbacks on a Model
Does anyone know how to disable a model''s callbacks?
I have a routine that increments a page_view counter for various model
objects in an after_filter in my ApplicationController. I call this:
increment_page_view()
Rather that checking through the trace array in each model callback for
"increment_page_view" I''d rather disable the callbacks from inside
2006 Jun 07
1
railstidy
Hi there,
anyone had any trouble with railstidy?
I''m using it on 1.1.2 just to tidy my output and I get a server error everytime, but the only log message I get is:
FastCGI: incomplete headers (0 bytes) received from server "/var/rails/dev/public/dispatch.fcgi"
I have:
after_filter :tidy
def tidy
RailsTidy.filter(response)
end
...in my application.rb and I can get
2012 May 31
1
Rack Middleware or after filter
Hi All
I need an solution that i should catch response and based
on some conditions i have to modify response body and send back to
client.
I have tried with a Middleware and got a solution.Can i use a
Middleware or simply one after_filter.
On performance wise which is best.Or is there any other ways to do it.
thanks in advance.
--
You received this
2006 Dec 07
2
backgrounDRb problems with results and MiddleMan
Hi there,
I''ve been experimenting with implementing BackgroundDRb in my rails app but
am running into some problems.
The primary problem I''m getting is in cleaning up worker threads, or getting
any kind of response out of worker threads.
If try using the response function/hash in my Worker the worker will not
execute reporting that response is an unknown variable or function.
2006 Jan 05
1
unicode hacks - fixes for webrick and Safari
Hello!
First, thank you Julian for the useful plugin ''unicode_hacks'' <
http://julik.textdriven.com/svn/tools/rails_plugins/unicode_hacks/>.
I have found some problems running my app in development on Webrick
and looking at it with Safari (MacOS X 10.4.3, Safari 2.0.2). Some
files are sent with different sizes (e.g. default css example, or
controls.js ), and it