Class: IshManager::EmailActionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::EmailActionsController
- Defined in:
- app/controllers/ish_manager/email_actions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Alphabetized : ).
- #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 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 8 def create @act = @email_action = Office::EmailAction.new :create, @act next_ids = params[:email_action].delete(:next_email_actions) next_ids.delete("") Office::EmailAction.where(prev_email_action_id: params[:id] ).update_all(prev_email_action_id: nil) next_ids.each do |next_id| next_action = ::Office::EmailAction.find next_id next_action.update_attribute( :prev_email_action_id, params[:id] ) end flag = @act.update_attributes( params[:email_action].permit! ) if flag flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}" end redirect_to action: 'index' end |
#edit ⇒ Object
30 31 32 33 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 30 def edit @act = @email_action = Office::EmailAction.find( params[:id] ) :edit, @act end |
#index ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 35 def index @email_actions = Office::EmailAction.all :index, @new_email_action end |
#new ⇒ Object
41 42 43 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 41 def new :new, @new_email_action end |
#show ⇒ Object
45 46 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 45 def show end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/ish_manager/email_actions_controller.rb', line 48 def update @act = @email_action = Office::EmailAction.find( params[:id] ) :update, @act next_ids = params[:email_action].delete(:next_email_actions) next_ids.delete("") Office::EmailAction.where(prev_email_action_id: params[:id] ).update_all(prev_email_action_id: nil) next_ids.each do |next_id| next_action = ::Office::EmailAction.find next_id next_action.update_attribute( :prev_email_action_id, params[:id] ) end flag = @act.update_attributes( params[:email_action].permit! ) if flag flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}" end redirect_to action: 'index' end |