Class: Clearance::UsersController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Clearance::UsersController
- Defined in:
- app/controllers/clearance/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #new ⇒ Object
- #redirect_signed_in_users ⇒ Object private
- #url_after_create ⇒ Object private
- #user_from_params ⇒ Object private
- #user_params ⇒ Object private
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/clearance/users_controller.rb', line 10 def create @user = user_from_params if @user.save sign_in @user redirect_back_or url_after_create else render template: "users/new", status: :unprocessable_entity end end |
#new ⇒ Object
5 6 7 8 |
# File 'app/controllers/clearance/users_controller.rb', line 5 def new @user = user_from_params render template: "users/new" end |
#redirect_signed_in_users ⇒ Object (private)
23 24 25 26 27 |
# File 'app/controllers/clearance/users_controller.rb', line 23 def redirect_signed_in_users if signed_in? redirect_to Clearance.configuration.redirect_url end end |
#url_after_create ⇒ Object (private)
29 30 31 |
# File 'app/controllers/clearance/users_controller.rb', line 29 def url_after_create Clearance.configuration.redirect_url end |
#user_from_params ⇒ Object (private)
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/clearance/users_controller.rb', line 33 def user_from_params email = user_params.delete(:email) password = user_params.delete(:password) Clearance.configuration.user_model.new(user_params).tap do |user| user.email = email user.password = password end end |
#user_params ⇒ Object (private)
43 44 45 |
# File 'app/controllers/clearance/users_controller.rb', line 43 def user_params params[Clearance.configuration.user_parameter] || {} end |