From: Eduardo Blumenfeld Date: 2010-06-21T13:59:38+09:00 Subject: Update FK_ID at validation/save time in activerecor I have: ------------------------ class Customer < ActiveRecord::Base belongs_to :Customer_Type end class Customer_Type < ActiveRecord::Base has_many :Customers end ------------------------ Is there a built-in way to auto populate customer_type_id based on the "Human name" of the Customer_Type_ID? ------------------------ c = Customer.new( :name => "John Doe", :customer_type_name => "Wholesale" ) ------------------------ # c[:Customer_Type_ID] == 10 (if 10 is the id for the "Wholesale" customer type) -- Posted via http://www.ruby-forum.com/.