-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError: undefined method `expire_action' for #<FormulasSweeper:0x00000004e935f0 @controller=nil> #54
Comments
I finally found a way to make it working ... not perfect but working. In my controller I set the class FormulasController < ApplicationController
...
caches_action :index, cache_path: 'formulas'
cache_sweeper :formulas_sweeper, only: :index
def index
...
end
end And then I expire the fragment myself in my Sweeper: class FormulasSweeper < ActionController::Caching::Sweeper
observe Import
def after_update(import)
ActionController::Base.new.expire_fragment('formulas')
end
end |
Was getting "NoMethodError: undefined method `expire_action' " in specs, despite including the new gems. This is a hack to get around it, exploiting the fact that pages and actions seem to be implemented as fragments under the hood: rails/actionpack-action_caching#54 (comment)
Was getting "NoMethodError: undefined method `expire_action' " in specs, despite including the new gems. This is a hack to get around it, exploiting the fact that pages and actions seem to be implemented as fragments under the hood: rails/actionpack-action_caching#54 (comment)
Was getting "NoMethodError: undefined method `expire_action' " in specs, despite including the new gems. This is a hack to get around it, exploiting the fact that pages and actions seem to be implemented as fragments under the hood: rails/actionpack-action_caching#54 (comment)
Was getting "NoMethodError: undefined method `expire_action' " in specs, despite including the new gems. This is a hack to get around it, exploiting the fact that pages and actions seem to be implemented as fragments under the hood: rails/actionpack-action_caching#54 (comment)
Thank you @dgmstuart for your contributions and @Angelmmiguel for merging the PR. Does this mean this issue can be closed ? |
@zedtux yes, I think you can close it. The only difference with the code above is to use
Btw, the PR was merged but the new version is not released yet. |
Was getting "NoMethodError: undefined method `expire_action' " in specs, despite including the new gems. This is a hack to get around it, exploiting the fact that pages and actions seem to be implemented as fragments under the hood: rails/actionpack-action_caching#54 (comment)
I have the same issue but in my running application (not RSpec) with rails 5.1.4.
In my controller:
And my Sweeper class:
The Sweeper is running and failing with the following error when I'm updating an
Import
from the Rails console, or from a Sidekiq job:@nnattawat's fix from rails/rails-observers#31
Updating my Sweeper as following:
Makes the code fail with:
This is due to the fact that
ActionController::UrlFor.url_options
is expecting arequest
object which isnil
in my case.The text was updated successfully, but these errors were encountered: