How to extract all attributes with Rails Jbuilder?
Maybe you can use json.merge!. json.merge! notification.attributes https://github.com/rails/jbuilder/blob/master/lib/jbuilder.rb#L277
Maybe you can use json.merge!. json.merge! notification.attributes https://github.com/rails/jbuilder/blob/master/lib/jbuilder.rb#L277
For anyone that is having the same issue. I have figured it out. You must call render_views within the controller tests you are doing. If you do that, you should then see a response.body with your JSON contained 🙂
Try to rename your file index.json.builder to index.json.jbuilder
It depends on your preference and needs. If you are working with Ember.js front-end, I’d lean towards active_model_serializers since Ember.js was basically crafted to work well with it (Yehuda Katz is one of the maintainers of active_model_serializers and is on the core team for Ember.js; he gave a talk on the topic a while back). … Read more
You have created the json there, which will be returned, and in that json will be an identification of the status – 400. However, that’s not telling Rails to send the 400 status in the header. You could do: render json: { error: “No such user; check the submitted email address”, status: 400 }, status: … Read more