api broken
Closed this issue · 0 comments
Asp3ctus commented
after your commits to close #16
a few bugs are introdused to break the app again :)
nested routes in compund:
map.resources 'users', (usesr)->
uses.resources 'posts', (posts)->
posts.post 'rate.:format?', 'posts#rate'
it used to be
user = {id : 4}
post = {id: 2}
pathTo.user_post( user, post) to create /users/4/posts/2
pathTo.user_post( 4, 2) to create /users/4/posts/2
pathTo.user_post_rate( 4, 2) to create /users/4/posts/2/rate
now it is:
pathTo.user_post( user, post) creates /users/4/posts/4
pathTo.user_post( 4, 2) creates /users/4/posts/2
pathTo.user_post_rate( 4, 2) creates /users/4/posts/2/rate
pathTo.user_post_rate( user, post) creates /users/4/posts/2/rate
pathTo.user_post_rate( {user_id: user.id, id : post.id}) creates /users/4/posts/undefined/rate
but i guess you wanted:
pathTo.user_post( {user_id: user.id, id : post.id}) to create /users/4/posts/4
the problem is that API is not same now
and OLD code is broken .....
i think both methods should work
i like the idea to pass the object to pathTo method, but alse some times it is much better to pass each param separatly