Class: ClarkKent::ReportEmailsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/clark_kent/report_emails_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#clark_kent_user

Instance Method Details

#createObject



10
11
12
13
14
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 10

def create
  @report_email = ClarkKent::ReportEmail.new(report_email_params)
  @report_email.save
  render partial: 'edit', locals: {report_email: @report_email}
end

#destroyObject



30
31
32
33
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 30

def destroy
  @report_email.destroy
  head :ok
end

#editObject



20
21
22
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 20

def edit
  render partial: 'edit', locals: {report_email: @report_email}
end

#newObject



5
6
7
8
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 5

def new
  @report_email = ClarkKent::ReportEmail.new(report_id: @report.id)
  render partial: 'form', locals: {report_email: @report_email}
end

#showObject



16
17
18
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 16

def show
  render partial: 'show', locals: {report_email: @report_email}
end

#updateObject



24
25
26
27
28
# File 'app/controllers/clark_kent/report_emails_controller.rb', line 24

def update
  @report_email.update_attributes(report_email_params)
  @ajax_flash = {notice: "Your changes were saved."}
  render partial: 'show', locals: {report_email: @report_email}
end