I have a user resource and a task resource. a task belongs to a user and user has many tasks.
I'm using rspec and resource_controller created a bunch of tests automatically.
And so the tests in my tasks_routing_spec.rb broke. I changed them FROM :
it "should map { :controller => 'tasks', :action => 'show', :id => '1'} to /tasks/1" do
route_for(:controller => "tasks", :action => "show", :id => "1").should == "/tasks/1"
end
TO:
it "should map { :controller => 'tasks', :action => 'show', :id => '1', :user_id => '1'} to /users/1/tasks/1" do
route_for(:controller => "tasks", :action => "show", :id => "1", :user_id => "1").should == "/users/1/tasks/1"
end
I'm doing this manually and I'd like to know if there is a "better"/"automatic" way to do this?
Thanks