On Apr 1, 9:34 pm, szimek <szi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I''m trying to use sweepers for the first time and got a problem -
I
> get "undefined method `merge'' for "/signature/
> f2d7c7c66450b169.html":String". The
"/signature/f2d7c7c66450b169.html"
> part of the error message is the cached page.
>
> Here''s my sweeper:
> class FooSweeper < ActionController::Caching::Sweeper
> observe Foo
>
> def after_save(foo)
> expire_cache(foo)
> end
>
> def after_destroy(foo)
> expire_cache(foo)
> end
>
> def expire_cache(foo)
> expire_page signature_path(:opaque_id => foo.opaque_id) # line 13
> expire_page signature_image_path(:opaque_id => foo.opaque_id)
> end
>
> end
>
> The signature_path(:opaque_id => string) generates "/signature/
> string.html" route, so this part works correctly.
>
> Here''s stack trace:
> .../vendor/rails/actionpack/lib/action_controller/caching.rb:125:in
> `expire_page''
> .../vendor/rails/actionpack/lib/action_controller/caching.rb:612:in
> `send''
> .../vendor/rails/actionpack/lib/action_controller/caching.rb:612:in
> `method_missing''
> #{RAILS_ROOT}/app/sweepers/foo_sweeper.rb:13:in `expire_cache''
> #{RAILS_ROOT}/app/sweepers/foo_sweeper.rb:5:in `after_save''
> .../app/controllers/foo_controller.rb:61:in `unsubscribe''
>
> Any ideas what can be wrong? I''m using Rails 1.2.6.
> Thanks in advance
Solved it myself - just changed expire_page to
ApplicationController.expire_page. I''m not sure why it didn''t
work
before - I was using Railscast 89 - "Page caching" as the reference.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---