Skip to content

Instantly share code, notes, and snippets.

@Olefine
Created August 26, 2013 11:42
Show Gist options
  • Select an option

  • Save Olefine/6340610 to your computer and use it in GitHub Desktop.

Select an option

Save Olefine/6340610 to your computer and use it in GitHub Desktop.
backup message controller action create
def create
@recipient = User.find(params[:message][:recipient_id])
@message = current_user.send_message(@recipient, params[:message][:body])
images_params = params[:message][:images_attributes]
respond_with(@message) do |format|
if @message.save!
if images_params.present?
uploader = AmazonImageUploader.new(@message.id, images_params)
uploader.process
end
format.js
format.json { render json: [@message.images.first.to_jq_upload].to_json }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment