Displaying 20 results from an estimated 23 matches for "caches_action".
2007 Jan 22
2
caches_action :index for site root gets propagated to lower levels (how to stop?)
Hello all,
I am running a blog system which has its "/" (home page) cached like
this:
class ApplicationController < ActionController::Base
before_filter :index_cache_expirer, :only => [:index]
caches_action :index
so the site''s top page is caches for 60 seconds in my case
(index_cache_expirer is a home-made function to expire)
on the site, there is also a multi-user /admin area, which in turn has
its own controllers with :index action.
The problem is that effect of "caches_action :ind...
2006 Feb 13
3
caches_action does not go off the entire URL
I am trying to use caches_action and the agile book says that it is keyed
off the URL, however it does not seem to pick up the URL parameters.
http://localhost:3000/controller/action/id?foo=bar
and
http://localhost:3000/controller/action/id?foo=foobar
Returns the same page.
Anyone looked into how to add URL parameters to the ca...
2008 Sep 24
3
caches_page :if not executing (but caches_action :if) does
...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 evaluates
correctly.
There are before_filters in the controller, but they do not apply to
this action. (There''s one in the supercontroller but it seems
similarly irrelevant - just trims www. from URLs.)
What am I missing? Did I uncover an :if bug (which I doubt) or am I
misunders...
2006 Aug 23
0
Caches_action/ before_filter problem .
Hello, I have a method called "check_permission" that is set to run as a
before_fitler and which checks if a user has the authorization to view a
page.
This page is displayed through the method "show" which is cached through
the tag "caches_action :show"
My problem is that once a user with authorization to a page accesses it,
then afterwards all users (with or without authorization) can access it.
It seems that once the page is displayed once, then the before_filter''s
result is cached and thus authorization is never checked...
2006 May 07
0
caches_action and render_component
I''ve made some test:
------------------ CODE ------------------
class FooController < ActionController::Base
caches_action :foo
def foo
render_text ''Hello, foo<br />''
end
end
class BarController < ActionController::Base
def bar
render :inline => <<-EOS
Hello, bar <br />
<%= render_component(:controller => ''foo'', :action => &...
2006 May 31
1
Using caches_action ?
Hi
When I enable action caching in my controller with
caches_action :view_thread
only the first part of my layout template is rendered (up to the yield
statement), and the development.log shows
Processing ForumController#view_thread (for 127.0.0.1 at 2006-05-31
03:13:19) [GET]
Session ID: d6f7ef15f479250fd7e31e252d70f5ff
Parameters: {"action"=>...
2007 Oct 28
0
caches_action - can I change the path?
How can I change:
subdomain.domain.com/directory.file.cache
to
directory/file.cache
I''d like to set how my action cache files are created.
--~--~---------~--~----~------------~-------~--~----~
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
2006 Jun 28
7
caching objects
...nted to say my sorries in advance (sorrie/sorry/sorri)...i have
just started learning about the subject of caching, but unfortunately
haven''t effictively managed to implement what i had learned.
obviously it''s possible to cache a whole page, or action with the
caches_page :x or caches_action :y methods, but for some reason it
hasn''t really worked with what i had been doing. (i was trying to cache
Time.now to no avail)
either way, the issue at hand (not Time.now) is trying to cache an
object that i will usually pull out of the database once per
session...say i have a table...
2006 May 18
2
tracking latency in rails
...as the response gets sent out. Do i need to bookend each
action with a before-filter and after-filter? Also, how could i track these
numbers independent of caching? From my understanding, if i use rails
caching, it will not go into the code if the page exists in the cache.
I know that if i use caches_action, then the filters will be run, however,
its important that i can log the times as close to the use as possible. I
think this means either just before it hits dispatch.fcgi or just after.
For certain actions i''d also like to log request information (referer urls,
IP address, etc). Does th...
2012 May 11
14
What is the point of using :format in routes?
Today I had a strange behavior that made me suspect of jQuery at first,
but then it happened that I''ve faced two gotchas, one from CoffeeScript
and one from Rails itself.
I have something like this:
routes.rb
post ''/fields/:id.:format'' => ''fields#show'', as: :field,
constraints: {id: /\d+/}
post ''/fields/remove/:id''
2006 Mar 12
0
Conditional Action Caching?
I have a system that requires login. This is for administrative
purposes, so the pages will be the same as the public ones, except they
will have the edit|delete|new options.
Right now, I have:
caches_action :index
which works great, but I''d like:
caches_action :index unless user?
where user?() is defined in application.rb.
I get an exception using this construct. Can anyone help?
Thanks,
Steve
--
Posted via http://www.ruby-forum.com/.
2005 Mar 24
3
Caching computation in rails?
Caching computation in rails?
Simple example: factorial modulus a large number
input: integer x
output: factorial( x ) % 12345678901234567
I want it so that if it computes factorial of N once, it will not have
to compute for N again.
code:
class SiteController < ApplicationController
caches_action :factorial, :inv
def examine
@inv = @params[''inv'']
@outv = factorial @inv.to_i
end
def factorial( inv )
y=1
while (inv > 0) do
y*=inv
inv-=1
end
(y % 12345678901234567)
end
end
I am running in production mode so caching should...
2007 Feb 03
1
How can I bypass caching for some users
I have action caching setup for several actions of an application but I
want the caching to only run for my administrators and have all other
users see non-cached pages. Is there a way to do this? Perhaps
something like passing a block to caches_action or setting some sort of
flag in my authentication method? If this is not possible with action
or fragment caching does anyone know of a plug in or other means to
accomplish this sort of caching scheme?
Thank you,
Matthew Margolis
blog.mattmargolis.net
--~--~---------~--~----~------------~----...
2006 Mar 29
2
Fragment Cache Wackiness
...gt; ActionController::Base.fragment_cache_store
=> #<ActionController::Caching::Fragments::FileStore:0x8f81bac
@cache_path="/www/apps/localfeeds/directory/tmp/fragmentcache/">
In a controller:
class ExportController < ApplicationController
before_filter :locale_finder
caches_action :rss, :opml, :top10opml
...
Yet tmp/fragmentcache/ remains empty (and removing the directory or
making it unwritable produces no errors in production.log)
I can tell by response times and watching production.log that it IS
caching, so I can only assume it''s still using the default...
2006 Jan 19
1
Caching suggestions
Hi ,
I have created a simple app which allows user logins and when user logs in
a home page is shown which is built using some queries to the DB. I tried
caching which didnt work properly because for some reason rails kep loading
the old cache..Anyway What I was wondering is caching only avoids the render
process but IMHO the queries are the most consuming.
My code is something like
def index
2007 Mar 26
2
Calling a controller action from script/console or runner
Is there a way to call or invoke a controller method from script/console
or script/runner? The reason is that I''d like to pre-cache some of the
actions on my controller.
The pseudo code below is what I''d like to be able to do:
class MyController < ApplicationController
caches_action :test
def test
puts ''Hi there''
end
end
script/console:
>> MyController.test
=> ''Hi there''
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are su...
2012 Dec 14
1
Re: Digest for rubyonrails-core@googlegroups.com - 4 Messages in 3 Topics
...ils/rails/blob/3-2-stable/actionpack/lib/action_controller/caching/actions.rb#L135>.
> •
> •
> • I''m working on a library where I''d like to tag my caches so that I can
> • expire sets of keys easily. It would appear that something such as
> •
> • caches_action :show, tag: Proc.new { "post_#{params[:id]}" }
> •
> • would evaluate to the tag to post_1, post_2 etc but it doesn''t. It
> • wouldn''t take much to modify the filter method linked above to evaluate
> • all procs passed in as options. I''m goin...
2012 Jan 27
2
to_json performance
...e first problem, AR
objects.
Having a result set of 50k entries is obviously painful, and doing it
with AR it will kill your instance, no questions asked.
Worse, in my use case this result set can be asked frequently from the
client.
This however can be easily solved by using a sapient mixture of
`caches_action`and `stale?`, although there may be few key issues when
using memcached and friends, because especially in managed
implementations, they may not support data keys larger than 1MB.
Since instantiating AR objects it''s out of the question let''s focus
and getting what we really want...
2006 Jun 30
0
Caching & Attachments
I''m noticing a different behavior between development and production
environments when I use caches_action along with send_data.
I have a method:
def image
@thePic = Picture.find(params[:id])
send_data(@thePic.image.data, :filename => @thePic.image.filename,
:type => @thePic.image.content_type, :disposition => "attachment")
end
Which works fine; it returns an image as...
2006 Feb 21
2
caching and admin area
...ted some ''public'' controllers like so:
./script/generate controller example
and an ''admin'' controller like this:
./script/generate controller admin/example
now i want to have caching in the ''public'' controllers so i add
something like this:
caches_action :show, :whatever
but i want the ''admin'' controller to do the sweeping. now if i add this
to the ''admin'' controller it doesn''t work as the :controller field is
referring to the ''admin'' controller:
expire_action(:controller => '&...