Sha256: 9292c6e565f4b3e27057f90c738f51a718058a34e5d7fa1fcf2123994c566e05
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require_dependency 'comable/apartment/application_controller' module Comable module Apartment class TenantsController < Comable::Apartment::ApplicationController load_and_authorize_resource class: Comable::Tenant.name, find_by: :name def index @tenants = @tenants.order(:created_at) end def show render :edit end def new end 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 def edit end 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 def destroy @tenant.destroy redirect_to comable_apartment.tenants_path, notice: Comable.t(:successful) end private def tenant_params params.require(:tenant).permit( :name, :domain ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comable-apartment-0.0.1 | app/controllers/comable/apartment/tenants_controller.rb |