MiquelVald

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

I'm deploying a Rails API only app with MongoDB Atlas on Heroku. I'm using Postman to test the application. When I do a GET request the response is null, but when I do a POST I get a Internal Server Error (500).

Using heroku logs --tail, I noticed an ArgumentError in a controller, I already tested this API locally and it didn't give me any problem.

This is the results of heroku log: https://prnt.sc/ylor8d
This is the post controller, line 20 is the if statement:

def create
@post = Post.new(post_params)

if @post.save
render json: @post, status: :created, location: @post
else
render json: @post.errors, status: :unprocessable_entity
end
end
And the function for parameters is this

def post_params
params.require(:post).permit(:title, :body)
end