Check your params for the correct property id parameter. -eric
On Nov 17, 4:33 pm, "Todd A. Jacobs" <tjacobs-sndr- [email protected]> wrote: > On Tue, Nov 17, 2009 at 04:16:46PM -0800, Eric wrote: > > routes.rb: > > map.resources :properties, :has_many => :notes > > <%= link_to 'New note', new_property_note_path(@property) %> > > I did that, and it works for views (e.g. "/properties/4/notes/2"). However, I > get this error when I try to actually create a note: > > ActiveRecord::RecordNotFound in NotesController#create > Couldn't find Property without an ID > > In my notes_controller.rb, I have: > > def new > @note = Note.new > respond_to do |format| > format.html > end > end > > def create > @note = Property.find(params[:id]).notes.create(params[:note]) > @note.user_id = current_user.id > > respond_to do |format| > if @note.save > flash[:notice] = 'Note was successfully created.' > format.html { redirect_to property_path @note.property_id } > else > format.html { render :action => "new" } > end > end > end > > So, something is still not quite right. How is @note supposed to get the > property id from params here? > > -- > "Oh, look: rocks!" > -- Doctor Who, "Destiny of the Daleks" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.

