Trouble with routes in Rails 2.0

Hi,

I has a nested restful route in routes.rb, which works nicely with
1.2.6:

map.resources :checklists, :member => {
:invite => :post,
:accept => :any,
} do |checklists|
checklists.resources :tasks, :member =>
{
:invalidate => :any,
:close => :any,
:reopen => :any,
:reorder => :any,

        :collapse => :any,
        :expand => :any,
      }

end

For such a definition, i used path like

tasks_path(checklist_id)

After upgrade to Rails 2.0, I’m getting the error message:

undefined method `tasks_path’ for #ActionView::Base:0x69090b0

Has no idea where to look at how to fix the problem. rake routes
doesn’t show generated paths.

Any help?

Regards,
KIR

Answering myself.
There are two solutions I found:

  1. Replace tasks_path with checklist_tasks_path
  2. Rewrite routing like:

map.resources :checklists, :member => {
:invite => :post,
:accept => :any,
}
map.resources :tasks, :path_prefix => ‘/
checklists/:checklist_id’, :member => {
:invalidate => :any,
:close => :any,
:reopen => :any,
:reorder => :any,

        :collapse => :any,
        :expand => :any,
 }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs