Class: MessagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MessagesController
- Includes:
- ApplicationHelper
- Defined in:
- app/controllers/messages_controller.rb
Overview
Copyright © 2010, Diaspora Inc. This file is
licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file.
Instance Method Summary (collapse)
Methods included from ApplicationHelper
#bookmarklet, #direction_for, #get_javascript_strings_for, #hard_link, #how_long_ago, #info_text, #mine?, #object_fields, #object_path, #owner_image_link, #owner_image_tag, #person_image_link, #person_image_tag, #person_link, #post_yield_tag, #profile_photo, #rtl?, #timeago, #type_partial
Methods inherited from ApplicationController
#after_sign_in_path_for, #clear_gc_stats, #ensure_http_referer_is_set, #ensure_page, #grammatical_gender, #redirect_unless_admin, #set_git_header, #set_grammatical_gender, #set_header_data, #set_invites, #set_locale, #which_action_and_user
Instance Method Details
- (Object) create
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/messages_controller.rb', line 12 def create cnv = Conversation.joins(:conversation_visibilities).where(:id => params[:conversation_id], :conversation_visibilities => {:person_id => current_user.person.id}).first if cnv = Message.new(:conversation_id => cnv.id, :text => params[:message][:text], :author => current_user.person) if .save Rails.logger.info("event=create type=comment user=#{current_user.diaspora_handle} status=success message=#{message.id} chars=#{params[:message][:text].length}") Postzord::Dispatch.new(current_user, ).post redirect_to conversations_path(:conversation_id => cnv.id) else render :nothing => true, :status => 422 end else render :nothing => true, :status => 422 end end |