Class: MessagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- MessagesController
- Defined in:
- app/controllers/messages_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /messages POST /messages.xml.
-
#destroy ⇒ Object
DELETE /messages/1 DELETE /messages/1.xml.
-
#edit ⇒ Object
GET /messages/1/edit.
- #index ⇒ Object
-
#new ⇒ Object
GET /messages/new GET /messages/new.xml.
-
#show ⇒ Object
GET /messages/1 GET /messages/1.xml.
-
#update ⇒ Object
PUT /messages/1 PUT /messages/1.xml.
Instance Method Details
#create ⇒ Object
POST /messages POST /messages.xml
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/messages_controller.rb', line 38 def create @recipients = Array.new if params[:_recipients].present? params[:_recipients].each do |recp_id| recp = Actor.find_by_id(recp_id) next if recp.nil? @recipients << recp end end @receipt = @actor.(@recipients, params[:body], params[:subject]) if (@receipt.errors.blank?) @conversation = @receipt.conversation flash[:success]= t('mailboxer.sent') redirect_to conversation_path(@conversation, :box => :sentbox) else render :action => :new end end |
#destroy ⇒ Object
DELETE /messages/1 DELETE /messages/1.xml
65 66 67 |
# File 'app/controllers/messages_controller.rb', line 65 def destroy end |
#edit ⇒ Object
GET /messages/1/edit
32 33 34 |
# File 'app/controllers/messages_controller.rb', line 32 def edit end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/messages_controller.rb', line 5 def index redirect_to conversations_path(:box => @box) end |
#new ⇒ Object
GET /messages/new GET /messages/new.xml
23 24 25 26 27 28 29 |
# File 'app/controllers/messages_controller.rb', line 23 def new if params[:receiver].present? @recipient = Actor.find_by_slug(params[:receiver]) return if @recipient.nil? @recipient = nil if Actor.normalize(@recipient)==Actor.normalize(current_subject) end end |
#show ⇒ Object
GET /messages/1 GET /messages/1.xml
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/messages_controller.rb', line 11 def show if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation if @conversation.is_participant?(@actor) redirect_to conversation_path(@conversation, :box => @box, :anchor => "message_" + @message.id.to_s) return end end redirect_to conversations_path(:box => @box) end |
#update ⇒ Object
PUT /messages/1 PUT /messages/1.xml
59 60 61 |
# File 'app/controllers/messages_controller.rb', line 59 def update end |