class EmailsController < ApplicationController before_action :set_email, only: [:show, :edit, :update, :destroy] # GET /emails def index @emails = Email.order(date: :desc).page(params[:page]) 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 redirect_to emails_url, notice: 'Email was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_email @email = Email.find(params[:id]) end # Only allow a list of trusted parameters through. def email_params params.fetch(:email, {}) end end