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