Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Created December 13, 2010 21:39
Show Gist options
  • Save johanbrook/739643 to your computer and use it in GitHub Desktop.
Save johanbrook/739643 to your computer and use it in GitHub Desktop.
def create
@message = Message.new(params[:message])
if @message.save
if session[:sent]
@messages = current_user.messages.sent.arrived_at_asc.paginate(:page => params[:page], :per_page => 5)
else
@messages = current_user.messages.queued.created_at_desc.paginate(:page => params[:page], :per_page => 5)
end
flash[:success] = "Mail is successfully queued and will be sent on #{@message.arrived_at}"
#Add to mail queue
else
flash[:failure] = "Mail was not queued, please fix the errors"
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment