Hi, I have a data model like this:
event
has_many :topics, :accessible => true
has_many :themes, :accessible => true
has_many :sessions
basically, if an event has 2 themes and 2 topics, it will have four
sessions:
(topicA+theme1, topicB+theme2, topicA+theme2, topicB+theme1)
I am modifying the "new" action and I want to add some code to create
these session objects after the user saves their new event.
I assume I want to do something like this:
def new
hobo_new
# eventid = id of newly created event (how do I do this)
themes.each do |theme|
topics.each do |topic|
session = Session.new
session.event_id=eventid
session.topic_id=topic.id
session.theme_id=theme.id
end
end
end
What I can't figure out is how to get the id of the newly created
event so that I can use it when creating the child session objects.
Any advice would be greatly appreciated
Thanks
Alex bowyer
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.