Skip to content

Instantly share code, notes, and snippets.

@kenton
Last active December 16, 2015 22:18
Show Gist options
  • Save kenton/5505556 to your computer and use it in GitHub Desktop.
Save kenton/5505556 to your computer and use it in GitHub Desktop.
# getting this json format in the response
[{"product":{"id":160,"name":"3.1 Phillip Lim Dress"}},{"product":{"id":161,"name":"3.1 Phillip Lim Skirt"}},{"product":{"id":178,"name":"3.1 Phillip Lim Dress"}},{"product":{"id":175,"name":"3.1 Phillip Lim Dress"}},{"product":{"id":156,"name":"3.1 Phillip Lim Wool Dress"}},{"product":{"id":158,"name":"3.1 Phillip Lim Plaid Skirt"}},{"product":{"id":159,"name":"3.1 Phillip Lim Silk Pants"}},{"product":{"id":162,"name":"3.1 Phillip Lim Woven Blazer"}},{"product":{"id":163,"name":"3.1 Phillip Lim Strapless Dress"}},{"product":{"id":164,"name":"3.1 Phillip Lim Tiered Skirt"}},{"product":{"id":166,"name":"3.1 Phillip Lim Shift Dress"}},{"product":{"id":167,"name":"3.1 Phillip Lim Beaded Tee"}},{"product":{"id":168,"name":"3.1 Phillip Lim Silk Dress"}},{"product":{"id":171,"name":"3.1 Phillip Lim Shearling Jacket"}},{"product":{"id":172,"name":"3.1 Phillip Lim Printed Sweater"}}]
# need this format in the response
[{"id":156,"name":"3.1 Phillip Lim Wool Dress"},{"id":157,"name":"3.1 Phillip Lim Wool Pant Suit"},{"id":158,"name":"3.1 Phillip Lim Plaid Skirt"},{"id":159,"name":"3.1 Phillip Lim Silk Pants"},{"id":160,"name":"3.1 Phillip Lim Dress"},{"id":161,"name":"3.1 Phillip Lim Skirt"},{"id":162,"name":"3.1 Phillip Lim Woven Blazer"},{"id":163,"name":"3.1 Phillip Lim Strapless Dress"},{"id":164,"name":"3.1 Phillip Lim Tiered Skirt"},{"id":165,"name":"3.1 Phillip Lim Dress w/ Tags"}]
rabl keeps throwing an error when I try something like this:
# in index.json.rabl
collection @collection, :root => 'products', :object_root => false
keep getting ActionView::TemplateError becaue of the hashrockets
Thoughts?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment