order for nested resources

1 view
Skip to first unread message

petr.blaho

unread,
Dec 16, 2009, 10:40:18 AM12/16/09
to Searchlogic
Hi,

please, can someone help me construct order link for nested resources?

I have this code: http://gist.github.com/257917
and I am trying to make searchlogic hit /posts/:post_id/comments and
return sorted comments for one post.

Order helper produces link to /comments url which then returns
comments for all posts.

What I am doing wrong?

Thank, Petr

petr.blaho

unread,
Dec 17, 2009, 3:51:58 AM12/17/09
to Searchlogic
Hi,

I have resolved this problem.

I had defined routes in this order:
map.resources :comments
map.resources :posts, :has_many => :comments

Changing order of these two lines is enough to do what I need
- order helper creates /post/:post_id/comments link when params
[:post_id] exists
and /comments when params[:post_id] is nil.

Petr

Reply all
Reply to author
Forward
0 new messages