You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry to post this as an issue but I have not been able to find any useful Google results on this nor get help on SO etc. I think this is a fairly common question so I hope you can simply point me to the documentation I'm failing to find...
Using RABL in Rails 3.2.x, given the following controller action:
$ curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"foo":{"kitten":"please"}}' http://hades.local:3000/foos
{"foo":{"kitten":"please","unicorn":null,"rainbow":null,"errors":{"unicorn":["can't be blank"]}}}
Read up more about it in the ActionController's Responder under the Custom Options section at the top. It's just the way Rails handles errors given the default JSON responder. Nothing RABL specific.
Sorry to post this as an issue but I have not been able to find any useful Google results on this nor get help on SO etc. I think this is a fairly common question so I hope you can simply point me to the documentation I'm failing to find...
Using RABL in Rails 3.2.x, given the following controller action:
Assuming the validation fails, how do you get respond_with to use a RABL template instead of the standard JSON hash of errors?
IE. The current response would be something like:
{ errors: { error: { base: "Record is invalid." } } }
I would prefer the response to use my
create.json.rabl
template to return the complete@foo
object including an errors node.I tried duplicating the
create
template and naming itshow
andnew
but neither of those worked. So what am I missing here?The text was updated successfully, but these errors were encountered: