我正在查看一些开源代码以更好地熟悉 Rails 代码。
我在下面看到application_controller
def can_signup?
[ :allowed, :needs_approval ].include? Setting.user_signup
end
我似乎无法找到该方法在代码中的定义位置Setting.user_signup
Setting
是一个模型
我能错过什么?代码链接:https ://github.com/fatfreecrm/fat_free_crm/blob/master/app/controllers/application_controller.rb#L155-157
grep 输出:
/rails_projects/fat_free_crm $ grep -r --include="*.rb" "user_signup" .
./app/controllers/application_controller.rb: [ :allowed, :needs_approval ].include? Setting.user_signup
./app/controllers/users_controller.rb: if Setting.user_signup == :needs_approval
./app/models/users/user.rb: self.suspended? && self.login_count == 0 && Setting.user_signup == :needs_approval
./app/models/users/user.rb: self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin
./spec/controllers/authentications_controller_spec.rb: Setting.stub!(:user_signup).and_return(:needs_approval)
./spec/controllers/users_controller_spec.rb: Setting.stub!(:user_signup).and_return(:needs_approval)
./spec/models/users/user_spec.rb: Setting.stub(:user_signup).and_return(:needs_approval)
./spec/models/users/user_spec.rb: Setting.stub(:user_signup).and_return(:needs_approval)