Class: Georgia::MessagesController
Instance Method Summary
collapse
#current_ability, #current_locale
Instance Method Details
#destroy ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'app/controllers/georgia/messages_controller.rb', line 17
def destroy
ids = params[:id].split(',')
if @messages = Message.destroy(ids)
render layout: false
else
head :internal_server_error
end
end
|
#destroy_all_spam ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/controllers/georgia/messages_controller.rb', line 26
def destroy_all_spam
if Message.spam.destroy_all
redirect_to :back, notice: 'All spam messages have been successfully deleted.'
else
redirect_to :back, alert: 'Oups. Something went wrong.'
end
end
|
#ham ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'app/controllers/georgia/messages_controller.rb', line 48
def ham
@message = Message.find(params[:id])
if @message.ham! == false
@message.update_attribute(:spam, false)
redirect_to :back, notice: 'Message successfully marked as ham.'
else
redirect_to :back, alert: 'Oups. Something went wrong.'
end
end
|
#index ⇒ Object
9
10
11
|
# File 'app/controllers/georgia/messages_controller.rb', line 9
def index
redirect_to action: :search
end
|
#search ⇒ Object
13
14
|
# File 'app/controllers/georgia/messages_controller.rb', line 13
def search
end
|
#show ⇒ Object
34
35
36
|
# File 'app/controllers/georgia/messages_controller.rb', line 34
def show
@message = Message.find(params[:id]).decorate
end
|
#spam ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/georgia/messages_controller.rb', line 38
def spam
@message = Message.find(params[:id])
if @message.spam!
@message.update_attribute(:spam, true)
redirect_to :back, notice: 'Message successfully marked as spam.'
else
redirect_to :back, alert: 'Oups. Something went wrong.'
end
end
|