Class: CitizenBudgetModel::UsersController

Inherits:
CitizenBudgetModelController show all
Defined in:
app/controllers/citizen_budget_model/users_controller.rb

Instance Method Summary collapse

Methods inherited from CitizenBudgetModelController

#admin?, #check_authorization!, #set_locale, #simulators, #sort, #users

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/citizen_budget_model/users_controller.rb', line 17

def create
  @user = collection.new(user_params)

  if @user.save
    redirect_to users_path, notice: _('User was created.')
  else
    render :new
  end
end

#editObject



14
15
# File 'app/controllers/citizen_budget_model/users_controller.rb', line 14

def edit
end

#indexObject



6
7
8
# File 'app/controllers/citizen_budget_model/users_controller.rb', line 6

def index
  @users = collection.all.sort_by(&:email)
end

#newObject



10
11
12
# File 'app/controllers/citizen_budget_model/users_controller.rb', line 10

def new
  @user = collection.new
end

#updateObject



27
28
29
30
31
32
33
# File 'app/controllers/citizen_budget_model/users_controller.rb', line 27

def update
  if @user.update(user_params)
    redirect_to users_path, notice: _('User was updated.')
  else
    render :edit
  end
end