Class: IshManager::LeadsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::LeadsController
- Defined in:
- app/controllers/ish_manager/leads_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 19 def create @lead = Ish::Lead.new params[:lead].permit! @lead.profile = current_user.profile :create, @lead if @lead.save flash[:notice] = "created lead" else flash[:alert] = "Cannot create lead: #{@lead.errors.}" end redirect_to :action => 'index' end |
#edit ⇒ Object
36 37 38 39 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 36 def edit @lead = Ish::Lead.find params[:id] :edit, @lead end |
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 3 def index :index, Ish::Lead @leads = Ish::Lead.where( :profile => current_user.profile, :is_trash => false ) if params[:is_done] @leads = @leads.where( :is_done => true ) else @leads = @leads.where( :is_done => false ) end render :layout => 'ish_manager/application_no_materialize' end |
#new ⇒ Object
14 15 16 17 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 14 def new @new_lead = Ish::Lead.new :new, @new_lead end |
#show ⇒ Object
31 32 33 34 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 31 def show :redirect, IshManager::Ability redirect_to :action => :edit, :id => params[:id] end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 41 def update @lead = Ish::Lead.find params[:id] :update, @lead if @lead.update_attributes params[:lead].permit! flash[:notice] = 'Successfully updated lead.' else flash[:alert] = "Cannot update lead: #{@lead.errors.}" end redirect_to :action => 'index' end |