In my messages_controller I have the following private method:
def find_message_or_404(slug)
message = user.messages.find_by_slug(slug)
if message.nil?
raise Error404
end
message
end
I find it not elegant and not very Rubist. Is there a way to improve it?