Class: Comable::Apartment::TenantsController
Instance Method Summary
collapse
#current_ability, #current_comable_user
#admin_roles, #link_to_save, #store_url_options
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 19
def create
if @tenant.save
redirect_to comable_apartment.tenant_path(@tenant), notice: Comable.t(:successful)
else
flash.now[:alert] = Comable.t(:failure)
render :new
end
end
|
#destroy ⇒ Object
40
41
42
43
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 40
def destroy
@tenant.destroy
redirect_to comable_apartment.tenants_path, notice: Comable.t(:successful)
end
|
#edit ⇒ Object
28
29
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 28
def edit
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 8
def index
@tenants = @tenants.order(:created_at)
end
|
#new ⇒ Object
16
17
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 16
def new
end
|
#show ⇒ Object
12
13
14
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 12
def show
render :edit
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'app/controllers/comable/apartment/tenants_controller.rb', line 31
def update
if @tenant.update_attributes(tenant_params)
redirect_to comable_apartment.tenant_path(@tenant), notice: Comable.t(:successful)
else
flash.now[:alert] = Comable.t(:failure)
render :edit
end
end
|