We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm having an JSON API with endpoints like: POST /contacts/1/tasks to create a Task for a Contact.
Her is setup like:
class ApiModel include Her::Model include_root_in_json true parse_root_in_json false end class Contact < ApiModel has_many :tasks end class Task < ApiModel belongs_to :contact end
However when I try to do:
Contact.find(1).tasks.create(:some_attributes => 1)
It POSTs to /tasks instead of /contacts/1/tasks (in contrast with what the documentation says).
Any idea what I'm doing wrong here? or any way to make this work with shallow routes (see: http://edgeguides.rubyonrails.org/routing.html#shallow-nesting)? This would mean:
The text was updated successfully, but these errors were encountered:
I suspect you need need a collection_path in Task like " /contacts/:contact_id/tasks"
but the larger issue of shallow routes is my new thorn
"Her" seems to have no knowledge of this concept
update: this seems to work https://github.com/remiprev/her/blob/4824f6f18e4de091fede948cf362728c851f3654/lib/her/model/paths.rb#L80
Sorry, something went wrong.
No branches or pull requests
I'm having an JSON API with endpoints like:
POST /contacts/1/tasks to create a Task for a Contact.
Her is setup like:
However when I try to do:
It POSTs to /tasks instead of /contacts/1/tasks (in contrast with what the documentation says).
Any idea what I'm doing wrong here? or any way to make this work with shallow routes (see: http://edgeguides.rubyonrails.org/routing.html#shallow-nesting)?
This would mean:
The text was updated successfully, but these errors were encountered: