Class: WcoEmail::EmailActionsController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- WcoEmail::EmailActionsController
- Defined in:
- app/controllers/wco_email/email_actions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 6 def create @sch = Sch.new( params[:email_action].permit! ) :create, @sch flag = @sch.save if flag flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@sch.errors..join(', ')}" end redirect_to request.referrer ? request.referrer : leadsets_path end |
#edit ⇒ Object
19 20 21 22 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 19 def edit @sch = Sch.find params[:id] :edit, @sch end |
#index ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 24 def index @email_actions = WcoEmail::EmailAction.all :index, @email_actions if params[:q] email_template_ids = WcoEmail::EmailTemplate.where( slug: /#{params[:q]}/i ).map &:id email_action_template_ids = WcoEmail::EmailActionTemplate.any_of( { :email_template_id.in => email_template_ids }, { slug: /#{params[:q]}/i }, ).map &:id @email_actions = @email_actions.where({ :email_action_template_id.in => email_action_template_ids, }) end end |
#new ⇒ Object
40 41 42 43 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 40 def new @email_action = WcoEmail::EmailAction.new :new, @sch end |
#show ⇒ Object
45 46 47 48 49 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 45 def show @sch = Sch.find params[:id] :show, @sch redirect_to action: 'edit' end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/wco_email/email_actions_controller.rb', line 51 def update @sch = Sch.find params[:id] :update, @sch flag = @sch.update_attributes( params[:email_action].permit! ) if flag flash[:notice] = "Success." else flash[:alert] = "No luck: #{@sch.errors..join(',')}." end render action: 'edit' end |