У меня есть моя первая модель Contact
с полем :email
и мне нужно это же поле :email
в моей модели Customer
со значением поля :email
, который находится в моей модели Contact
.Рубин на рельсы доступ к модели информации к другой модели
Я использую Mongoid для ОРМ, так вот моя первая модель Контакт
class Contact
include Mongoid::Document
include Mongoid::Timestamps
embedded_in :customer
embedded_in :employee
embedded_in :restaurant
field :city
field :street
field :zip_code
field :country
field :phone_number
field :email
и моя вторая модель клиента
class Customer
include Mongoid::Document
include Mongoid::Timestamps
embeds_one :contact
devise :database_authenticatable, :lockable, :recoverable,
:rememberable, :registerable, :trackable, :timeoutable, :validatable,
:token_authenticatable
attr_accessible :email, :password, :password_confirmation
field :first_name
field :last_name
field :password
field :gender
field :encrypted_password
Спасибо.