uhm sorry i don't get the actual problem, but before_filter surely is
the wrong place, plus in your above code @unit wasnt initialized in any
way, so its no ARObject of the Uni Model and has no method/attribute
class Unitcontroller < ...
@unit = Unit.new(params[:unit]) # if you have a hidden field with
name="unit[building_id]", the building_id will be assigned with this
@unit.building_id = session[:building_id] # You can assign like this
from the session., if you dont want to use a hidden field.
Hidden fields are more common for this type of thing imho..