Ok still working on my Many to Many association. I'm having a slight
problem with the create method in the controller.
Here is the code
def create
@space = Space.find_by_id(params[:space][:id])
hobo_create do
@this.spaces=[@space]
@this.building = @space.floor.building
#@this.save!
redirect_to @space if valid?
end
end
As coded above the spaces get saved to the db fine but the building doesn't.
I must uncomment the @this.save! to get the building to be saved to the db.
Any idea why or how to work around doing a second save to the db?
Note: spaces is the many to many link while the building is the belongs_to
side of a one to many link
Bob
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/LFxVNOIMrLEJ.
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.