0

Having trouble accessing POST params using Mailgun. Here's my route.rb and incoming_controller.rb files. Basically, I want to update my view with the data from the incoming emails.

post :incoming, to: 'incoming#create'

Controller

class IncomingController < ApplicationController

  skip_before_filter :verify_authenticity_token, only: [:create]

  def index
  end

  def create
    puts "INCOMING PARAMS HERE: #{params}"
    @subject = Incoming.new(params[:subject])
    @subject.save

    @sender = Incoming.new(params[:from])
    @sender.save
    @body = Incoming.new(params[:'body-plain'])
    @body.save

    head 200
  end
end

I can see the request as it's coming into heroku (via heroku logs), but it's not being stored. I also need to test it locally

user3465296
  • 145
  • 1
  • 12

1 Answers1

0

Try setting up the params in your create action as follows:

sender = params["sender"]
body_plain = params["stripped-text"]
kryss88ltj
  • 23
  • 6