nesquena / rabl

General ruby templating with json, bson, xml, plist and msgpack support
http://blog.codepath.com/2011/06/27/building-a-platform-api-on-rails/
MIT License
3.64k stars 334 forks source link

Pluralization Issue? #630

Closed joelcdoyle closed 9 years ago

joelcdoyle commented 9 years ago

I'm having an issue when my object is something like @families and I want to create a node using the singular version, @family:

collection @families, object_root: false
attributes *Family.column_names
node(:members){ |family| family.members }

Results in:

> undefined method 'key?' for #
    1   collection @families, object_root: false
>   2   attributes *Family.column_names
    3   node(:members){ |family| family.members }

I have other templates that are similar that work find:

collection @cameras, object_root: false
attributes *Camera.column_names
node(:obscure_id){ |camera| camera.obscure_id }
node(:viewable_times){ |camera| camera.viewable_times }
joelcdoyle commented 9 years ago

This was not a pluralization issue, but an issue on my part for not realizing that family.members returns a relationship.