Setup has_many routes

Hi,

I’m trying to accomplices this with REST :slight_smile:

http://localhost:3000/admin/projects/11/tasks/assigns/:user_id

This is my route config.

map.namespace :admin do |admin|
admin.resources :projects, :has_many => {:tasks => {:assigns =>
:post}}
admin.resources :tasks
end

But I’m not getting it right?

Can anyone show me the correct way of doing that :slight_smile:

I also tried:
admin.resources :projects, :has_many => {:tasks, :collection =>
{:assigns => :post}}

Thanks for help.

Well, that wasn’t hard :smiley:

map.namespace :admin do |admin|
admin.resources :projects do |project|
project :tasks, :collection => {:assigns => :post}
end
admin.resources :tasks
end

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