search for: county_id

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

Did you mean: country_id
2006 Jun 16
3
Does HABTM support non "id" FKs?
Quick question. Say I have a geographical database with counties and zip codes where counties have and belong to many zip codes. zip_codes (id, zip_code) counties (id, name) When I create the association table, the Rails way says to do the following: counties_zip_codes (county_id, zip_code_id). However, given that zip_codes.zip_code is itself a candidate key, I would much prefer to do the following: counties_zip_codes (county_id, zip_code), as this removes the need to join with the 42K record zip_codes table. However, when I do the following in the my model: class Zip...
2006 Aug 04
1
how to count totals for each unique name in a table?
...ementon(3), etc.... etc... so basically it seems that there needs to be another model with a county has_many towns relationship and somehow relate that to the doctor info table. So i am guessing i will have a hash of some sort, grab the first county in the county table and then get towns == county_id AND in the doctor_type table, count the amount of doctor_types where Town == current town in interation loop. Afterwards, move unto the next hash space for the next county and repeat. etc... so its like i may have to create an array of hashes?!?!! -- Posted via http://www.ruby-forum.com/.
2006 Aug 06
1
creating hash table, how do i? please help
hi, i have a noob question. how do i create a table but add additional fields? for example.. i have a total_table of total, county, and town where total_table inherites county_id and town_id from my town_county table where county_id has_many towns. in my view, id like to go through the hash like this table total_table for total_table.county { print total_table.county print total_table.county.total for total_table.town { print total_table.count...
2005 Dec 23
2
Bizarre problems with AJAX / missing variables
...-group"> <label for="contact_town_id">Town / Dublin area [<%= county %>|<%= rawcode %>]:</label> <% unless county.nil? %> <%= select(''contact'', ''town_id'', Town.find(:all, :conditions => [ ''county_id = ?'', county ] ).collect {|t| [ t.name, t.id ] }, { :include_blank => true }) %> <% else %> <%= select(''contact'', ''town_id'', Town.find_all.collect {|t| [ t.name + ", Co. " + t.county.name, t.id ] }, { :include_blank =>...
2006 Mar 11
0
Using :joins - How to help Rails populate a list of records from a complex join
...: def find_in_state(state) State.find :all, :limit => 10, :conditions => [''s.id = ? AND '' + ''s.id = c.state_id AND c.state_id = ? AND '' + ''c.id = col.county_id AND '' + ''s.id = l.state_id AND l.state_id = ? AND '' + ''g.id = l.group_id AND '' + ''sc.location_id = l.id'', state,...
2006 Jan 26
0
Bug with table_name_prefix?
Hi all, I think I have found a bug in ActiveRecord''s handling of eager loading when using table_name_prefix. Here is a reduction of the problem : class Cheese < ActiveRecord::Base ## ## id SERIAL ## name VARCHAR(32) ## county_id INTEGER ## belongs_to :county def self.table_name_prefix "stuff_" end end class County < ActiveRecord::Base ## ## id SERIAL ## name VARCHAR(32) ## has_many :cheeses def self.table_name_prefix "stuff_"...
2006 Jul 02
1
multitable form
Hi all, Although I''m experienced with programming I''m a beginner with ruby, RoR and MVC So I follow examples from books and so on and all is ok. I can make a model who is a class and who match to a table in my database and then I generate pretty forms on a webpage. I would like to know how I can do to make forms who interact with more than one table. For an example lets
2009 Mar 14
9
null object pattern
...igned a null user object for anonymous/ mot-logged-in user, i.e. if session variable has nil data. In my User model, I have created a subclass like this: class UnassignedUser < User def save false end def update false end def username "Unassigned" end def county_id "-999" end def role_id "5" end end When I go to console to try out this model following is the output: >> UnassignedUser.new NameError: uninitialized constant UnassignedUser from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dep...