On 12 May 2016 11:44 p.m., "Luis" <luismcdougall@gmail.com> wrote:
>
> Ok there is something that I am not getting in here I think this should work. What am I missing ?
>
> class Sched < ActiveRecord::Base
> belongs_to :admiting_md, :foreign_key => :admiting_md ,:class_name => "Pcp"
> end
>
> class Pcp < ActiveRecord::Base
> has_many :admiting_mds, :foreing_key => :admiting_md, :class_name => "Sched"
You have still misspelt foreign.
Colin
> end
>
> Same error
> BTW James I took that Benadryl. ;-)
>
> -Luis
>
>
>
> On Thursday, May 12, 2016 at 2:28:12 PM UTC-4, Luis wrote:
>>
>> 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/30695cbf-a903-48f9-885c-0c08498e155a%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
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/CAL%3D0gLtB4qgDDc8fPrj5XF_pXjoCZ7ddxN7jSNv-_4Cf1M%2B0iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment