Rails have Nested Resources for a while, and it has been heavy used (or overused). Say we have two model, Article and Comment.
class Article < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :article
end
Define the Nested Resource in routes.rb
resources :articles do
resources :comments
end
So now, we can list comments by specific article: http://localhost:3000/articles/1/comments
But Spine can only make url for post request to create Article and Comment like this:
/articles
/comments
How to make Spine's url for Ajax request like this?
/articles/1/comments
I know I can override the url() in Comment Model for retrieval comments, but what about creating a new record?
I also go through the source code as well, what I found is that the create() method in Spine's Ajax module doesn't care about the custom url() function in instance of Comment. what I want is just pass the article_id and using it with my custom url() function to generate url, then I can posting to server for create.
Does it possible without fork and modified version of Spine fo my own?
btw: sorry for my English, wish all of you guys can understand what I want to say about :-)
Thank you and best regards,