我对 Rails 还很陌生,正在尝试弄清楚如何向 ActiveView 类添加一个方法,以便我可以从部分访问一个新方法。
这是一些示例代码:
%li
=link_to "#{h aim_small.description.shorten} #{"(current aim)" if aim_small.description == current_aim.description}", :action => 'show', :id => aim_small
.options
=link_to "edit", :controller => 'aims', :action => 'edit', :id => aim_small
=link_to "remove", :controller => 'aims', :action => 'destroy', :id => aim_small
我希望能够在上述部分中调用 current_aim 方法,但无法让 Ruby 识别它的存在。
谢谢。