Class: Comable::Apartment::UsersController
Instance Method Summary
collapse
#current_ability, #current_comable_user
#admin_roles, #link_to_save, #store_url_options
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 22
def create
if @user.save
redirect_to comable_apartment.tenant_user_path(@tenant, @user), notice: Comable.t(:successful)
else
flash.now[:alert] = Comable.t(:failure)
render :new
end
end
|
#destroy ⇒ Object
43
44
45
46
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 43
def destroy
@user.destroy
redirect_to comable_apartment.tenant_users_path(@tenant), notice: Comable.t(:successful)
end
|
#edit ⇒ Object
31
32
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 31
def edit
end
|
#index ⇒ Object
11
12
13
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 11
def index
@users = @users.with_role(*admin_roles)
end
|
#new ⇒ Object
19
20
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 19
def new
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 15
def show
render :edit
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'app/controllers/comable/apartment/users_controller.rb', line 34
def update
if @user.update_attributes(user_params)
redirect_to comable_apartment.tenant_user_path(@tenant, @user), notice: Comable.t(:successful)
else
flash.now[:alert] = Comable.t(:failure)
render :edit
end
end
|