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