我有客户.rb
class Customer < ActiveRecord::Base
acts_as_authentic
has_many :credit_cards
has_many :telephones
has_many :virtual_pays
end
电话.rb
class Telephone < ActiveRecord::Base
belongs_to :customers
end
当我使用 Rails 控制台广告写入 Customer.all 时,我将从数据库表客户中获取所有数据,但是当我尝试获取包括客户电话在内的所有数据时,我收到错误我写:customers.telephones.all,然后我尝试客户。 Telephone.all,但如何正确执行此操作?
NameError: undefined local variable or method
customers' for main:Object from (irb):6 from /home/pp/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in
start' from /home/pp/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:8:instart' from /home/pp/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands.rb:23:in
'来自脚本/rails:6:inrequire' from script/rails:6:in
'
我也纠正了写模型?