2008年5月11日 星期日

helper

remove the logic from view to helper

ex:
module   TestHelper
              def  run
                       "test_title"
              end
end

in the test controller
<%=  run  %>

originally the function in the helper file can only be accessed by related view,
but there is method for sharing helper

sharing helper:
method 1:
define the method in application_helper.rb

method  2:
ex:
add  TestHelper  to controller
helper  :test

沒有留言: