How can I include the delivery_schedule attribute in this?
format.json { render :json => @campaign.to_json(:include =>
{:category => {:include => :subscriptions}}, :methods => :status) }
I tried this but I get an error:
format.json { render :json => @campaign.to_json(:include =>
[{:category => {:include
=> :subscriptions}}, :delivery_schedule], :methods => :status) }
NoMethodError (You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.macro):
/vendor/rails/activerecord/lib/active_record/serialization.rb:
55:in `add_includes''
Note: this works (I removed the category.subscriptions include):
format.json { render :json => @campaign.to_json(:include =>
[:category, :delivery_schedule], :methods => :status) }
Is there something wrong with my nesting?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---