Class: PoBox::EmailsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/po_box/emails_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /emails



25
26
27
28
29
30
31
32
33
# File 'app/controllers/po_box/emails_controller.rb', line 25

def create
  @email = Email.new(email_params)

  if @email.save
    redirect_to inbox_email_path(@inbox, @email), notice: "Email was successfully created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject

DELETE /emails/1



45
46
47
48
# File 'app/controllers/po_box/emails_controller.rb', line 45

def destroy
  @email.destroy
  redirect_to inbox_emails_url(@inbox), notice: "Email was successfully destroyed."
end

#editObject

GET /emails/1/edit



21
22
# File 'app/controllers/po_box/emails_controller.rb', line 21

def edit
end

#indexObject

GET /emails



7
8
9
# File 'app/controllers/po_box/emails_controller.rb', line 7

def index
  @emails = Email.all
end

#newObject

GET /emails/new



16
17
18
# File 'app/controllers/po_box/emails_controller.rb', line 16

def new
  @email = Email.new
end

#showObject

GET /emails/1



12
13
# File 'app/controllers/po_box/emails_controller.rb', line 12

def show
end

#updateObject

PATCH/PUT /emails/1



36
37
38
39
40
41
42
# File 'app/controllers/po_box/emails_controller.rb', line 36

def update
  if @email.update(email_params)
    redirect_to inbox_email_path(@inbox, @email), notice: "Email was successfully updated."
  else
    render :edit, status: :unprocessable_entity
  end
end