search for: json_attr

Displaying 1 result from an estimated 1 matches for "json_attr".

Did you mean: json_attrs
2010 Feb 16
0
as_json and self-referential associations
...on. However I am not sure how you are supposed to, or whether it is designed to handle multiple variations of association inclusion. For example I have a model using acts_as_tree, so that each instance has children and a parent: class CatalogueCategory < ActiveRecord::Base acts_as_tree JSON_ATTRS = [''id'', ''name'', ''description'', ''slug''] def as_json(options=nil) attributes.slice(*JSON_ATTRS).merge(:children => children, :ancestors => ancestors) end end The ancestors reference is an array of parent, grand...