Z
Z
zachfischer2018-07-02 12:27:23
Ruby on Rails
zachfischer, 2018-07-02 12:27:23

Failed to load resource: the server responded with a status of 400 (Bad Request)?

When I try to create an entry, I get the following error:

Started POST "/spr_type_events" for 127.0.0.1 at 2018-07-02 14:16:20 +0500
Processing by SprTypeEventsController#create as JSON
  Parameters: {"spr_type_event"=>{}}
Completed 400 Bad Request in 1ms

ActionController::ParameterMissing (param is missing or the value is empty: spr_type_event):

app/controllers/spr_type_events_controller.rb:43:in `spr_type_events_params'
app/controllers/spr_type_events_controller.rb:15:in `create'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2018-07-02
@2ord

It's written in the log:

Parameters: {"spr_type_event"=>{}}
That is, the form attributes required to create a SprTypeEvent are missing.
How can you get rid of it?
Submit the required attributes.
In line
params.require(:spr_type_event).permit!
when trying to extract attributes from :spr_type_event there was a bummer. :-)
There is also a typo in the create method:
"erros"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question