Buildings have units. Units have rooms. Rooms have people. I can grab
building, room, and people IDs and store them in a session[:variable].
However, when creating a new unit, I need to give that
session[:building_id] to ActiveRecord for creation. I’m not sure
whether to use hidden fields or do it all in the model
‘before_validation’ - in either case I don’t know how. My attempt
failed with an ‘Invalid method error’:
@unit.building_id = session[:building_id]
How can I add session variables to insert/create statements?