So I've updated my show method to look like:
def show
@itinerary = Itinerary.find(params[:id])
@new_event = @itinerary.events.build
end
but still no luck.
Thanks again.
--
Melih O.
On May 22, 8:21 pm, Melih Onvural <[email protected]> wrote:
> I'm sure I'm overlooking something really obvious, but I'm trying to
> figure out how to do a form for an object associated with the current
> view object.
>
> Specifically, I have an itinerary that has events. When I'm looking at
> an itinerary I should be able to add new events. My relationship
> between the two is:
>
> class Itinerary < ActiveRecord::Base
> has_many :event
> end
>
> class Event < ActiveRecord::Base
> has_one :itinerary
> end
>
> In the itineraries_controller, I have a show method defined like this:
>
> def show
> @itinerary = Itinerary.find(params[:id])
>
> @new_event = Event.new
> end
>
> However, it is clearly puking on the Event.new, and I'm looking for a
> good place to learn about how to work through all of these
> associations. If this isn't the place, I'd love a link to where this
> is taught.
>
> Thanks in advance.
> --
> Melih O.
--
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.