Ruby on Rails
Thursday, May 12, 2016
I am trying to establish the following relation, but no joy!
-- Can someone please tell me how should I do this.
Thanks.
Luis
#Sched attributes:
#id
#...
# pcp_id :integer
# admitingMd_id :integer
class Sched < ActiveRecord::Base
belongs_to :admitingMd, :class_name => "Pcp", :foreign_key => ":admitingMd_id"
#PCP attributes#id
#...
class Pcp < ActiveRecord::Base
has_many :scheds
has_many :admitingMd, :primary_key => "admitingMd_id", :foreing_key => "admitingMd_id", :class_name => "Sched"
ArgumentError - Unknown key: :foreing_key. Valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type:
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eb9304c3-7b75-4e46-ae10-b78ba4cd4c56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment