【发布时间】:2013-06-18 17:32:35
【问题描述】:
# application_helper.rb
def do_some_stuff
...
end
# my_model.rb
def my_model_method
# I want to call the method "do_some_stuff" here, how exactly?
end
显然,我不能只调用do_some_stuff,因为它会告诉我模型没有这个方法。
【问题讨论】:
-
你需要这样做吗?
-
不,你不能。在模型中编写方法并在对象上调用它
标签: ruby-on-rails model helpermethods