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?