A bit closer now. I now have it such that:
dive
belongs_to :location
end
I've got the initialize function following through, but it's still
throwing an error on this code here:
@location = @dive.create_location(params[:location])
@dive.location_id = @location.id
with the following error message:
"You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.delete"
any clues?
--
melih
On Dec 14, 5:00 am, Marnen Laibow-Koser <[email protected]> wrote:
> Melih Onvural wrote in post #968249:
>
> > I'm new to Rails3, and I'm just trying to get one last thing to work
> > before I call it a night. The situation is the following (please if
> > the code is horrible, just let me know, still learning):
>
> > I want to log a dive. I might have a new location on that dive at
> > which point I have to create a new Location, and then create the dive.
> > A dive has_one location. A location has_many dives. Currently the
> > foreign key is on dive as location_id.
>
> Then Dive belongs_to Location. Go review the difference between
> belongs_to and has_one.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
>
> Sent from my iPhone
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
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=en.