search for: building_id

Displaying 8 results from an estimated 8 matches for "building_id".

Did you mean: building_8
2006 Nov 10
3
Move variables from session to ActiveRecord?
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'': before_validation :set_building_i...
2007 Nov 30
2
Nested resources and _path methods
Hi guys, I was thinking aboiut this for a while: If I have nested resource routes, for example /building/1/floor/2/ room/ 3 (building has_many floors and so on), I have to call the room_path method like this: room_path @room.floor.building, @room.floor, @room Isn“t there a better way to handle nested routes with foreign keys, or can I have this method overwritten somewhere? Greets Jonas
2005 Dec 23
0
Problem with large join table and ActiveRecord
...explaining this, so I hope i can say this correctly. I have these tables: people id fname lname departments id name buildings id name room wtkeys id key_number key_way Issued_keys id people_id department_id building_id wtkey_id date_issued My question is when i need to insert a new issued_key do I just do something like: person = Person.new person.fname = "Robert" person.lname = "Boone" person.save! dept = Department.new dept.name = "IT"...
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
...ne, schema.equipment e1, schema.equipment e2, schema.building b, schema.cust_loc cl, schema.location loc WHERE e2.equipment_id = e1.equipment_id AND e2.some_column like ''SOME_VAL%'' AND e1.equipment_id = ne.net_element_id AND ne.class_name = ''FooBar'' AND e1.building_id = b.building_id AND b.main_address = cl.cust_loc_id AND cl.location_id = loc.location_id So, I setup a class for the ''Location'' table like this: class OracleLocation < ActiveRecord::Base establish_connection( :adapter => "oracle", :database =>...
2009 Jan 18
5
Modeling complex associations
Hi, Is there any default way to model something like the following situation in ActiveRecord?: A company has_many :buildings which are associated to :company, e.g. in a polymorphic way. Moreover one and only one of the buildings is the company''s headquarter. Thinking in terms of the database, I''d prefer to add an owning association, an thus have a has_many :buildings plus a
2006 Mar 17
0
Multiple Associations, Multiple Joins
...eign key, both referencing an employee table, or similar. Is there a way to make this work so that I can access each category with the same ease? 2. I have not been able to get two natural joins to work in the same query. That is, say I have 3 models, for instance, office with a foreign key of building_id, building with a foreign key of employee_id (the building manager), and employee. I cannot get any combination of :include in either associations or find method calls to work so that I can iterate over all offices and do office.building.employee without it needing to do a separate sql query fo...
2009 Apr 03
0
Alpha sorting on both options and groups for option_groups_from_collection_for_select
# How would you best perform a secondary sort on :buildings below? = ''Building Name'' = select_tag ''building_id'', | option_groups_from_collection_for_select(Site.all(:order => :full_name), | :buildings, :full_name, :id, :full_name, nil) | -- Thanks, Tyler Arrigoni President OneInterface.net Network Engineering, Inc. 7475 North Palm, Suite 105, Fresno, CA 93711 Voice: 559-437-3750 ext. 110...
2009 Feb 25
9
local variables in partials lead to NameError
I know I must be doing something dumb, but I can''t seem to send a local variable to my partial. The below code leads to the following error: NameError in Residential_listings#new undefined local variable or method `foo'' for #<ActionView::Base: 0x3fb53f8> I am trying to call the variable ''foo'' in a partial called _attachment.html.erb, which is nested in