English 中文(简体)
为什么铁路能够找到我的羊人?
原标题:Why rails can t find my sweepers?

我有我的控制者:

class FormulariosController < ApplicationController
    cache_sweeper :campanha_sweeper, :only => [:show]

    # actions
结束

我试图在服饰中建立一个叫作/扫清器的目录,并做 t工作,我尝试在模型中设置一个/Cache 夹(如用这个例子算出的博客),并做工。

我 looks切地看着这一点:

class CampanhaSweeper < ActionController::Caching::Sweeper
  observe Campanha

  def after_update(campanha)
    expire_cache_for(campanha)
  结束

  private
  def expire_cache_for(campanha)
    expire_page(:controller =>  formularios , :action =>  show )

    ap "Expired cache for formularios#show in formulariosweeper"
  结束

结束

我在努力启用服务器时,先是:

/Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.12/lib/action_controller/caching/sweeping.rb:41:in `const_get : uninitialized constant CampanhaSweeper (NameError)
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.12/lib/action_controller/caching/sweeping.rb:41:in `block in cache_sweeper 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.12/lib/action_controller/caching/sweeping.rb:39:in `each 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.12/lib/action_controller/caching/sweeping.rb:39:in `cache_sweeper 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/app/controllers/formularios_controller.rb:2:in `<class:FormulariosController> 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/app/controllers/formularios_controller.rb:1:in `<top (required)> 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/engine.rb:138:in `block (2 levels) in eager_load! 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/engine.rb:137:in `each 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/engine.rb:137:in `block in eager_load! 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/engine.rb:135:in `each 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/engine.rb:135:in `eager_load! 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/application.rb:108:in `eager_load! 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/application/finisher.rb:41:in `block in <module:Finisher> 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/initializable.rb:25:in `instance_exec 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/initializable.rb:25:in `run 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/initializable.rb:50:in `block in run_initializers 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/initializable.rb:49:in `each 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/initializable.rb:49:in `run_initializers 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/application.rb:134:in `initialize! 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/application.rb:77:in `method_missing 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/config/environment.rb:5:in `<top (required)> 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/config.ru:3:in `block in <main> 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/builder.rb:46:in `instance_eval 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/builder.rb:46:in `initialize 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/config.ru:1:in `new 
    from /Users/thiagomassa/Projects-ginga/ginga-campanhas/config.ru:1:in `<main> 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/builder.rb:35:in `eval 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/builder.rb:35:in `parse_file 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/server.rb:162:in `app 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/server.rb:253:in `wrapped_app 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.5/lib/rack/server.rb:204:in `start 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/commands/server.rb:65:in `start 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/commands.rb:30:in `block in <top (required)> 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/commands.rb:27:in `tap 
    from /Users/thiagomassa/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.12/lib/rails/commands.rb:27:in `<top (required)> 
    from script/rails:6:in `require 
    from script/rails:6:in `<main> 

Why didn t it work? Also, is there any way to expire cache of only a view(of how it s r结束ered). I m generating views on the fly and it would be very useful if I could expire the cache of a view that is located at say, views/formularios/a.html.rb

如果想知道我做些什么,那就简单了。 我提出形式的看法,如果我想更新这种观点(或守则)和一米生产的话,那么,由于砍刀,我不得不人工重新制作这种表格。

感谢。

最佳回答

页: 1

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签