Class: IshManager::LeadsetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::LeadsetsController
- Defined in:
- app/controllers/ish_manager/leadsets_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
alphabetized : ).
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
alphabetized : )
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 8 def create @leadset = Leadset.new params[:leadset].permit! @leadset.profile = @current_profile :create, @leadset if @leadset.save flash[:notice] = "created leadset" else flash[:alert] = "Cannot create leadset: #{@leadset.errors.}" end redirect_to :action => 'index' end |
#destroy ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 20 def destroy puts! params, 'params' leadsets = Leadset.find( params[:leadset_ids] ) @results = [] leadsets.each do |leadset| @results.push leadset.discard end flash[:notice] = "Discard outcome: #{@results.inspect}." redirect_to action: 'index' end |
#edit ⇒ Object
32 33 34 35 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 32 def edit @leadset = Leadset.find params[:id] :edit, @leadset end |
#index ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 37 def index :index, Leadset @leadsets = Leadset.all.kept # where( :profile => @current_profile, :is_trash => false ) # if params[:is_done] # @leadsets = @leadsets.where( :is_done => true ) # else # @leadsets = @leadsets.where( :is_done => false ) # end end |
#new ⇒ Object
47 48 49 50 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 47 def new @new_leadset = Leadset.new :new, @new_leadset end |
#show ⇒ Object
52 53 54 55 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 52 def show :redirect, IshManager::Ability redirect_to :action => :edit, :id => params[:id] end |
#update ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/ish_manager/leadsets_controller.rb', line 57 def update @leadset = Leadset.find params[:id] :update, @leadset if @leadset.update_attributes params[:leadset].permit! flash[:notice] = 'Successfully updated leadset.' else flash[:alert] = "Cannot update leadset: #{@leadset.errors.}" end redirect_to :action => 'index' end |