foodsoft/app/controllers/messages_controller.rb

31 lines
787 B
Ruby
Raw Normal View History

2009-01-06 11:49:19 +01:00
class MessagesController < ApplicationController
2009-01-06 11:49:19 +01:00
# Renders the "inbox" action.
def index
@messages = Message.public.paginate :page => params[:page], :per_page => 20, :order => 'created_at DESC'
2009-01-06 11:49:19 +01:00
end
2009-01-06 11:49:19 +01:00
# Creates a new message object.
def new
@message = Message.new(params[:message])
2009-01-06 11:49:19 +01:00
end
2009-01-06 11:49:19 +01:00
# Creates a new message.
def create
@message = @current_user.send_messages.new(params[:message])
if @message.save
#FIXME: Send Mails wit ID instead of using message.state ...
2012-08-17 19:08:02 +02:00
#call_rake :send_emails
@message.deliver
redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet."
2009-01-06 11:49:19 +01:00
else
render :action => 'new'
end
end
2009-01-06 11:49:19 +01:00
# Shows a single message.
def show
@message = Message.find(params[:id])
2009-01-06 11:49:19 +01:00
end
end