Tag: Rails/モデル
class Order has_one :order_dtail end
class Order has_one :order_dtail, :through => :order_dtail, :conditions => ['order.active = ?', true] end
class OrderDetail belongs_to :order end
belongs_to :software_info, :foreign_key => 'url', :primary_key => 'web_site_url'
belongs_to :ng_item, -> {where(kind: NgItem::KIND__URL)}, :foreign_key => 'url', :primary_key => 'value'