2011-07-09 104 views

回答

3

正如apneadiving說,使其成爲一個控制器的方法,並作出一個輔助方法。

application_controller.rb 

    helper_method :do_stuff 

    def do_stuff 
    #this method is available in all controllers and views 
+0

我投我的想法:) – apneadiving

0

我投爲@ apneadiving的想法。但在這裏:

class SomeController < ApplicationController 
    include SomeHelper 
end 
相關問題