EvoBal/app/controllers/emails_controller.rb

39 lines
749 B
Ruby
Raw Normal View History

2020-12-28 13:02:56 +01:00
class EmailsController < ApplicationController
before_action :set_email, only: [:show, :edit, :update, :destroy]
# GET /emails
def index
2021-01-30 21:59:25 +01:00
@emails = Email.order(date: :desc).page(params[:page])
2020-12-28 13:02:56 +01:00
end
# GET /emails/1
def show
end
# GET /emails/new
def new
@email = Email.new
end
# GET /emails/1/edit
def edit
end
# DELETE /emails/1
def destroy
@email.destroy
2021-01-31 12:16:37 +01:00
redirect_to emails_url, notice: 'Email was successfully destroyed.'
2020-12-28 13:02:56 +01:00
end
private
# Use callbacks to share common setup or constraints between actions.
def set_email
@email = Email.find(params[:id])
2020-12-28 13:02:56 +01:00
end
# Only allow a list of trusted parameters through.
def email_params
params.fetch(:email, {})
end
end