Sha256: 273c92987084c6b24c8bbbd0da6e2c4a4af939cc3f27ef0619dbe952a948539c

Contents?: true

Size: 852 Bytes

Versions: 4

Compression:

Stored size: 852 Bytes

Contents

class MessagesController < ApplicationController

  # Convenient method to create and check for spam
  def create
    @message = Georgia::Message.new(message_params)
    if @message.valid? and @message.save
      SpamWorker.perform_async(@message.id)
    end
    respond_to do |format|
      # FIXME: Add translated flash message on success and failure
      format.html { redirect_to :back }
      format.js   { render layout: false }
    end
  end

  private

  def message_params
    @message_params = {}
    params[:message].each do |key, value|
      @message_params[key] = value.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
    end
    @message_params[:referrer] = request.referrer
    @message_params[:user_ip] = request.remote_ip
    @message_params[:user_agent] = request.user_agent
    @message_params
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
georgia-0.7.3 app/controllers/messages_controller.rb
georgia-0.7.2 app/controllers/messages_controller.rb
georgia-0.7.1 app/controllers/messages_controller.rb
georgia-0.7.0 app/controllers/messages_controller.rb