我有一个User模型和一个users表。一个用户可以拥有多个电话号码,因此我有一个单独的命名为Phone
的模型。
我正在使用这个关联:
模型
User
attr_accessible :id, :name, :screenname,:fullname,:phones_attributes
has_many :phones,:dependent => :destroy
Phone
attr_accessible :phone
belongs to :users
以上代码运行良好。 管理员想将任何用户的记录复制到
user_temp
和phone_temp
表中(我有名为UserTemp和PhoneTemp的单独模型)。
我该怎么做?