我想我们会的
helper_method :current_user, :logged_in?, :authorized?
使这些控制器方法可用作视图中的辅助方法.但在Restful认证的lib/authenticated_system.rb
中,我看到:
# Inclusion hook to make #current_user and #logged_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :logged_in?, :authorized? if base.respond_to? :helper_method
end
为什么要这样做而不是那一行?而且,我看不到任何地方有人叫included
.