Class: FederalOffense::MessagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/federal_offense/messages_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



8
9
10
11
# File 'app/controllers/federal_offense/messages_controller.rb', line 8

def destroy
  message.destroy
  redirect_to messages_path
end

#destroy_allObject



13
14
15
16
# File 'app/controllers/federal_offense/messages_controller.rb', line 13

def destroy_all
  FederalOffense::Message.destroy_all
  redirect_to messages_path
end

#indexObject



18
19
# File 'app/controllers/federal_offense/messages_controller.rb', line 18

def index
end

#showObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/federal_offense/messages_controller.rb', line 21

def show
  if params[:raw]
    case params[:type]
    when "html"
      render html: message.html_body
    when "text"
      render plain: message.text_body
    else
      render message.html? ? {html: message.html_body} : {plain: message.text_body}
    end
  end
end