Class: Iron::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Iron::UsersController
- Defined in:
- app/controllers/iron/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/iron/users_controller.rb', line 22 def create person = Person.new(join_params) @user = User.new( authenticatable: person, language: preferred_admin_language ) if @user.save start_new_session_for @user redirect_to root_url else render :new, status: :unprocessable_entity end rescue ActiveRecord::RecordNotUnique redirect_to sign_in_url(email_address: join_params[:email_address]) end |
#destroy ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/iron/users_controller.rb', line 39 def destroy if @user.deactivate redirect_to users_path, notice: t("iron.users.notifications.removed"), status: :see_other else redirect_back fallback_location: users_path, alert: @user.errors..to_sentence, status: :see_other end end |
#index ⇒ Object
10 11 12 13 |
# File 'app/controllers/iron/users_controller.rb', line 10 def index @users = User.people.active @deactivated_users = User.people.where(active: false) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/iron/users_controller.rb', line 15 def new @user = User.new end |
#show ⇒ Object
19 20 |
# File 'app/controllers/iron/users_controller.rb', line 19 def show end |