REST: nested resources and attributes as resources

Thorsten, When I read this post I was thrilled to see a new world of possibilities opening up with nested RESTful resources. I jumped into my own code and tried passing in a params value as you show in your date example. I crashed and burned with a "You have a nil object when you didn't expect it! The error occurred while evaluating nil.to_sym" So we're on the same page, this is the example of yours that I'm looking at;

project_iterations_path(@project_id, :date => @wanted_date)

I assume that "@wanted_date" is an instance variable available on the current view and ":date" is simply an arbitrary symbol you chose to use? In my own example, I'm confident that my instance variable is valid and in scope...but Ruby doesn't like it. In testing your idea I modified on of my resource calls to look like this; <%= link_to 'Add to Favorites', efav_efavs_path(@user, :eitem => @eitem.id)%> I feel like I just got a Christmas present and opened the box to find it doesn't work....any ideas are appreciated. Kathy

Hi --

Thorsten, When I read this post I was thrilled to see a new world of possibilities opening up with nested RESTful resources. I jumped into my own code and tried passing in a params value as you show in your date example. I crashed and burned with a "You have a nil object when you didn't expect it! The error occurred while evaluating nil.to_sym" So we're on the same page, this is the example of yours that I'm looking at;

project_iterations_path(@project_id, :date => @wanted_date)

I assume that "@wanted_date" is an instance variable available on the current view and ":date" is simply an arbitrary symbol you chose to use? In my own example, I'm confident that my instance variable is valid and in scope...but Ruby doesn't like it. In testing your idea I modified on of my resource calls to look like this; <%= link_to 'Add to Favorites', efav_efavs_path(@user, :eitem => @eitem.id)%> I feel like I just got a Christmas present and opened the box to find it doesn't work....any ideas are appreciated.

You can't mix the plain arguments and the hash arguments. Try this:

   efav_efavs_path(@user, @eitem)

Which reminds me: I really have to go back and see how my Inferred Routes plugin fares with 2.0-ish Railses.... (Inferred Routes lets you leave off the left-hand arguments if they can be inferred, based on segment names, from the right-most argument.)

David