Sha256: 6e405c2c3c2c97182663accfe462411f5bd4a044b2227cd6beea79611261447c

Contents?: true

Size: 866 Bytes

Versions: 20

Compression:

Stored size: 866 Bytes

Contents

module DiscoApp::Admin::Concerns::SourcesController
  extend ActiveSupport::Concern

  included do
    before_action :find_source, only: [:edit, :update, :destroy]
  end

  def index
    @sources = DiscoApp::Source.all
  end

  def new
    @source = DiscoApp::Source.new
  end

  def create
    @source = DiscoApp::Source.new(source_params)
    if @source.save
      redirect_to admin_sources_path
    else
      render 'new'
    end
  end

  def edit
  end

  def update
    if @source.update_attributes(source_params)
      redirect_to edit_admin_plan_path(@source)
    else
      render 'edit'
    end
  end

  def destroy
    source.destroy
    redirect_to admin_sources_path
  end

  private

    def find_source
      @source = DiscoApp::Source.find(params[:id])
    end

    def source_params
      params.require(:source).permit(:source, :name)
    end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.0 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.1 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.2 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.3 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.4 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.5 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.6 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.7 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.8 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.14.1 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.14.2 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.15.0 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.16.0 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.14.4 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.14.3 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.16.1 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.15.2 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.14.0 app/controllers/disco_app/admin/concerns/sources_controller.rb
disco_app-0.13.6.pre.puma.pre.3 app/controllers/disco_app/admin/concerns/sources_controller.rb