Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with listing classes #356

Merged
merged 2 commits into from Apr 27, 2017
Merged

Fix bug with listing classes #356

merged 2 commits into from Apr 27, 2017

Conversation

peterjm
Copy link
Contributor

@peterjm peterjm commented Apr 27, 2017

The listing classes were broken, because they were trying to use the id field as a primary key, which doesn't exist for listings. This tells ActiveResource to use the underlying object id as the primary key.

This was the reason the URL for fetching the product ids for collections was "/admin/collection_listings//123/product_ids.json" (note the double "//") -- ActiveResource was trying to fill in an id between the slashes, but just ended up rendering an empty string (nil.to_s)

fake "collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
fake "collection_listings//1/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol. This bug was actually codified in a test too.

Copy link

@kenrose kenrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants