Reputation:
def store_params
params.require(:store).permit(:store)
end
I have an entity called store and its only column is also called store. Other frameworks seem to have solutions for this issues, but it's not clear how to do this properly on Rails.
{
"store": "derp"
}
I sent the above in a POST request and I am getting a seemingly unrelated error. How do I fix this?
Upvotes: 1
Views: 163
Reputation: 636
In this scenario the top-level key store
is expected to have an attribute on it named store
also. Try passing { "store": { "store": "derp" } }
in your POST request, and see if that works.
Here is some useful documentation on Rails params that might help: https://api.rubyonrails.org/classes/ActionController/Parameters.html
Upvotes: 1