Forum: Ruby on Rails caches_action and render_component

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fa1f6d9c0f7c529554bfefb91996924c?d=identicon&s=25 Li Jie (Guest)
on 2006-05-07 21:24
(Received via mailing list)
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 => 'foo', :id
=> params[:id]) %>
    EOS
  end
end

class FooBarController < ActionController::Base
  def foo_bar
    render :inline => <<-EOS
      Hello, bar <br />
      <%= render_component(:controller => 'foo', :action => 'foo', :id
=> params[:id]) %>
    EOS
  end
end
----------------- END CODE ---------------
When I access /foo/foo, I think that it should create a file
'/tmp/cache/localhost.3000/foo/foo.cache'. and it does.
When I access /foo/foo/1, it's created a file
'/tmp/cache/localhost.3000/foo/foo/1.cache', it's right.

When I access /bar/bar, I think that it should create a file
'/tmp/cache/localhost.3000/foo/foo.cache', but it's created the file
'/tmp/cache/localhost.3000/bar/bar.cache'. And I access
/foo_bar/foo_bar, it's created the file
'/tmp/cache/localhost.3000/foo_bar/foo_bar.cache'. Two files are the
same content.
This topic is locked and can not be replied to.