Sha256: cc253848ee456e635a3c3789c4b9ae9df7a9b0ce0b10cfb1b86f8dd0a6ea1ae3

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

module Org
  class Admin::OrganDomainsController < Admin::BaseController
    before_action :set_organ
    before_action :set_organ_domain, only: [:show, :edit, :update, :destroy]

    def index
      @organ_domains = @organ.organ_domains.page(params[:page])
    end

    def new
      @organ_domain = @organ.organ_domains.build
    end

    def create
      @organ_domain = @organ.organ_domains.build(organ_domain_params)

      unless @organ_domain.save
        render :new, locals: { model: @organ_domain }, status: :unprocessable_entity
      end
    end

    def show
    end

    def edit
    end

    def update
      @organ_domain.assign_attributes(organ_domain_params)

      unless @organ_domain.save
        render :edit, locals: { model: @organ_domain }, status: :unprocessable_entity
      end
    end

    def destroy
      @organ_domain.destroy
    end

    private
    def set_organ
      @organ = Organ.find params[:organ_id]
    end

    def set_organ_domain
      @organ_domain = OrganDomain.find(params[:id])
    end

    def organ_domain_params
      params.fetch(:organ_domain, {}).permit(
        :domain,
        :port,
        :subdomain,
        :host,
        :default,
        :appid
      )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_org-0.0.1 app/controllers/org/admin/organ_domains_controller.rb