Class: IshManager::EmailFiltersController
Instance Method Summary
collapse
#basic_auth, #home, #tinymce
Instance Method Details
#create ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 8
def create
authorize! :create, Office::EmailFilter
@email_filter = Office::EmailFilter.create params[:email_filter].permit!
if @email_filter.persisted?
flash[:notice] = 'Success'
else
flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
end
redirect_to action: 'index'
end
|
#destroy ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 19
def destroy
@email_filter = Office::EmailFilter.find params[:id]
authorize! :destroy, @email_filter
flag = @email_filter.destroy
if flag
flash[:notice] = 'Success'
else
flash[:alert] = 'Error'
end
redirect_to action: 'index'
end
|
#edit ⇒ Object
31
32
33
34
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 31
def edit
@email_filter = Office::EmailFilter.find params[:id]
authorize! :edit, @email_filter
end
|
#index ⇒ Object
36
37
38
39
40
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 36
def index
authorize! :index, Office::EmailFilter.new
@email_filter = Office::EmailFilter.new
@email_filters = Office::EmailFilter.active
end
|
#new ⇒ Object
42
43
44
45
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 42
def new
@email_filter = Office::EmailFilter.new
authorize! :new, @email_filter
end
|
#update ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'app/controllers/ish_manager/email_filters_controller.rb', line 47
def update
@email_filter = Office::EmailFilter.find params[:id]
authorize! :update, @email_filter
flag = @email_filter.update_attributes( params[:email_filter].permit! )
if flag
flash[:notice] = 'Success'
else
flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
end
redirect_to action: 'index'
end
|