0
我遇到了方法update
的問題。當我在控制器中給他打電話時,我失敗了NoMethodError - undefined method 'update' for InlineTextStorage:Class
可能是什麼原因?NoMethodError - InlineTextStorage的undefined方法'update':類
class StaticAreasController < ApplicationController
def update
@static_area = InlineTextStorage.update("key", "value")
end
end
class InlineTextStorage
def update(key, value)
inline_text = StaticArea.find_by_key!(key)
inline_text.text = value
@@texts[key] = value
update_cache
end
end
嘗試在'InlineTextStorage'模型中將這個'def update(key,value)'改爲'def self.update(key,value)' – Pavan