class MessagesController < ApplicationController
before_action :correct_user, only: [:index]
private
def correct_user
redirect_to root_path unless @conversation.sender_id == current_user.id || @conversation.receiver_id == current_user.id
end
end
scope :today, -> { where(:published_at.lt => 1.week.ago) }