Re:Rails 4.0: Final version released
by playing_colours on Tuesday June 25, 2013 @12:31PM
(#5940606)
Thanks, I'm building Angular.js app and adopting Rails 4 for api backend, Will Rails-API be updated for Rails 4 ?
[ Parent
| on HN ]
Re:Rails 4.0: Final version released
by steveklabnik on Tuesday June 25, 2013 @12:52PM
(#5940757)
It should work today. If it does not, it's a bug.
By the way, ActiveModel::Serializers is part of the Rails API project[1], and we'd love some thoughts on how to make it work well with Angular.
The only issue that's been biting me when using ActiveModel::Serializers and AngularJS is that we must manually return the json with the root: false option set, otherwise the AngularJS $resource provider doesn't work correctly.
If it helps you can make that the default for all your serializers, by doing something like this in an initializer:
ActiveSupport.on_load(:active_model_serializers) do
ActiveModel::ArraySerializer.root = false
ActiveModel::Serializer.root = false
endLooks like it already is: https://news.ycombinator.com/item?id=5940484