标签: ruby-on-rails ruby
演示文稿SOLID Ruby, SOLID Rails
如果定义了2个类:
class User < ActiveRecord::Base ... end class Registration < ActiveRecord::Base table_name = "users" ... end
然后我得到r = Registration.find(39)
r = Registration.find(39)
如何从没有数据库查询的u对象User获取类型r的相应对象u.id == r.id?
u
User
r
u.id == r.id