Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UsersController
- Defined in:
- app/controllers/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/users_controller.rb', line 7 def create if params[:commit] === 'Sign up' $user = User.create(user_params) if $user.save session[:user_id] = $user.id redirect_to root_path, notice: 'Sign in successfull' else redirect_to new_user_path, notice: 'Problems creeting a user' end else redirect_to new_user_path end end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/users_controller.rb', line 3 def index end |
#new ⇒ Object
23 24 25 26 27 |
# File 'app/controllers/users_controller.rb', line 23 def new redirect_to root_path unless session[:user_id].nil? @user = $user unless $user.nil? $user = nil end |
#user_params ⇒ Object
29 30 31 |
# File 'app/controllers/users_controller.rb', line 29 def user_params params.permit(:name, :email, :password, :password_confirmation) end |