初学者在这里,通过跳入项目学习Ruby on Rails。这个问题可能是纯粹的ruby,与rails没有任何关系。我也想指出我正在使用Active_Admin。使用类变量
我有以下2类:所有者和电话。
class Owner < ActiveRecord::Base
attr_accessible :email, :password,
has_many :phones
end
class Phone < ActiveRecord::Base
attr_accessible :owner_id :model
belongs_to :owner
end
我怎么会去访问该业主从手机模型中的电子邮件,例如:
form do |f|
f.inputs "Phone Details" do
f.input :model
f.input :owner_id # This is where I want the email, not the owners id.
end
f.buttons
end
它看起来像我应该检讨镐头书,跳入轨道之前改进我的红宝石。
感谢