是否可以仅允许现有用户注册新用户?我不希望任何人只有在您已经登录时才能访问/ users / sign_up页面。这是一个内部应用程序,因此所有用户都可以信任添加其他用户。
答案 0 :(得分:2)
你应该看看cancan宝石!
答案 1 :(得分:0)
您可以在您的环境中使用http身份验证。使用监狱长
<强>的ApplicationController 强>
before_filter :authenticate_homol
def authenticate_homol
if (Rails.env == 'staging') # for example
authenticate_or_request_with_http_basic do |username, password|
username == "login" && password == "123456"
end
warden.custom_failure! if performed?
end
end