Displaying 1 result from an estimated 1 matches for "new_song_path".
2006 Oct 21
0
find_or_initialize_by and Nested Resources
...s successfully saved. I
am retrieving the artist using something like:
@artist = find_or_intialize_by_country_id(@country)
Since the artist doesn''t exist yet, there will be no ''id'' attribute
yet. However, I have to pass in an id to the url which creates the
song, ie:
new_song_path(@artist)
This will obviously fail since @artist.id is nil. I can use
find_or_create_by instead, but then if the user cancels creating a
song, I will be left with an extra row in the artist table that I
don''t need.
Any ideas?
Shane Vitarana
http://shanesbrain.net
--~--~---------~--~---...