Class: WcoEmail::EmailFiltersController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- WcoEmail::EmailFiltersController
- Defined in:
- app/controllers/wco_email/email_filters_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #new2 ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 6 def create :create, WcoEmail::EmailFilter @email_filter = WcoEmail::EmailFilter.create params[:email_filter].permit! if @email_filter.persisted? flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@email_filter.errors..join(', ')}." end redirect_to action: 'index' end |
#destroy ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 17 def destroy @email_filter = WcoEmail::EmailFilter.find params[:id] :destroy, @email_filter flag = @email_filter.destroy if flag flash[:notice] = 'Success' else flash[:alert] = 'Error' end redirect_to action: 'index' end |
#edit ⇒ Object
29 30 31 32 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 29 def edit @email_filter = WcoEmail::EmailFilter.find params[:id] :edit, @email_filter end |
#index ⇒ Object
34 35 36 37 38 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 34 def index :index, WcoEmail::EmailFilter.new @email_filter = WcoEmail::EmailFilter.new @email_filters = WcoEmail::EmailFilter.all.includes( :email_template, :conversations ) end |
#new ⇒ Object
40 41 42 43 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 40 def new @email_filter = WcoEmail::EmailFilter.new :new, @email_filter end |
#new2 ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 44 def new2 @email_filter = WcoEmail::EmailFilter.new :new, @email_filter @new_email_filter_condition = WcoEmail::EmailFilterCondition.new end |
#show ⇒ Object
51 52 53 54 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 51 def show @email_filter = WcoEmail::EmailFilter.find params[:id] :show, @email_filter end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/wco_email/email_filters_controller.rb', line 56 def update @email_filter = WcoEmail::EmailFilter.find params[:id] :update, @email_filter if params[:email_filter][:tag].blank? params[:email_filter].delete :tag end flag = @email_filter.update_attributes( params[:email_filter].permit! ) if flag flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@email_filter.errors..join(', ')}." end redirect_to action: 'index' end |