Rails naming convention for Uppercase names
I've got a model class:
class QRCode < ActiveRecord::Base
  has_many :properties
end
So rails needs a database table named 'qr_codes' and a foreign key called 'qr_code_id'. But as a relationship in my Property Model it needs another name:
class Property < ActiveRecord::Base
  belongs_to :q_r_code
end
So if I want to create a Property object I' have to say ':q_r_code => qrcode' But active_record wants a qr_code property, because the column is called 'qr_code_id'
Do I understand something wrong or is this type of name impossible to map for Rails?
PS: I'm using Rails 3.0.3
 belongs_to接受:foreign_key和:class_name属性。 
上一篇: ActiveRecord:大小与数量
下一篇: 大写名称的Rails命名约定
