search for: state_cod

Displaying 4 results from an estimated 4 matches for "state_cod".

Did you mean: state_code
2006 May 28
3
Validating Foreign Key
...s City < ActiveRecord::Base has_many :schools belongs_to :state validates_presence_of :city_name validates_presence_of :state_id validates_associated :state end class State < ActiveRecord::Base has_many :cities validates_presence_of :long_name validates_presence_of :state_code validates_length_of :state_code, :is => 2 validates_uniqueness_of :state_code end -- END -- Regardless of all of that, my test can still create a city with a state_id of 91, and I do not have a 91 row in my states table. -- From test.log -- State Load (0.000907) SELECT * FROM states WH...
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
...Load (0.6ms) SELECT "shops".* FROM "shops" WHERE "shops"."user_id" = 1 LIMIT 1 (0.1ms) BEGIN (0.1ms) COMMIT => #<Shop id: nil, user_id: 1, name: "Alice Shop", primary_address: nil, secondary_address: nil, city: nil, postal_code: nil, state_code: nil, country_code: nil, phone: nil, email: nil, website: nil, facebook: nil, twitter: nil, opening_hours: nil, description: nil, latitude: nil, longitude: nil, logo: nil, currency: nil, created_at: nil, updated_at: nil> The weird thing is it does validate in the edit form using update_attribu...
2008 Mar 17
1
Help needed with collection_select
I''m trying to get a collection select list to work, but I''m getting this error: missing attribute: state_code The code is a select list for states. <%= collection_select(:states_code, :state, states.states_list, :state_code, :state)%> The above elements are as follows 1. table name (singular, full name is states_codes) 2. full name of state 3. select list that orders the states alphabetically (m...
2011 Mar 01
11
Did rails or shoulda go insane on the inflection of 'taxes'?
I have a model ''xp_jurisdiction_taxes'' which rails (3) created correctly. Another model ''xp_jurisdiction_states'' has many :xp_jurisdiction_taxes. In my spec I am using a shoulda helper to test the association but get the following error. BTW, greped the whole project just in case and the string ''taxi'' exists nowhere. 1)