我在文件app/helpers/application_view_helper.rb
中有一个方法:
module ApplicationViewHelper
...
def cache_key_with_permission_for_all model
...
end
end
我尝试从模型中访问它:
class Classification < ActiveRecord::Base
...
def self.get_current_cache_key
"index-#{ActionController::Base.helpers.cache_key_with_permission_for_all Classification}"
end
end
但我收到错误:
NoMethodError - undefined method `cache_key_with_permission_for_all' for #<ActionView::Base:0x00000004e3ac70>:
app/models/classification.rb:140:in `get_current_cache_key'
我错了什么?