2015-01-14 81 views

回答

3

使用helper_method,你可以在這裏看到:helpers.rb和波紋管:

ActiveSupport.on_load(:action_controller) do 
    helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session" 
end 

如果通過current_user搜索該文件,因爲色器件使用mapping佔位符,讓你做這樣的事情,你不會找到任何東西:

rails generate devise User # this will generate 3 helpers: current_user, user_signed_in? and user_session 

rails generate devise Blogger # this will generate 3 helpers: current_blogger, blogge_signed_in? and blogger_session 
相關問題