나는이 customer.rb모델 문제
class Customer < ActiveRecord::Base
acts_as_authentic
has_many :credit_cards
has_many :telephones
has_many :virtual_pays
end
telephone.rb 내가 레일을 사용하는 경우 콘솔 광고가 Customer.all 쓰기
class Telephone < ActiveRecord::Base
belongs_to :customers
end
, 난 DB 테이블에서 모든 데이터를 얻을 수 있습니다 고객,하지만 내가 모든 데이터를 가져 오려고 cutomer 전화를 포함하면 오류가 발생 작성 : customers.telephones.all, 그럼 난 Customer.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
' from script/rails:6:inrequire' from script/rails:6:in
'
필자도 올바른 모델을 작성 했습니까?
고객 전화 번호를 쿼리하는 방법을 알고 싶습니까? –
실제로 예 .... – byCoder