Wes G. wrote:
So just to be explicit, from class A (backed by database table Table_A),
attempting to relate to class B, (backed by database table Table_B),
joined by model C
has_many :Bs, :through => ‘C’,
:foreign_key => ‘key into Table_A’, :source => ‘B’
So there is no reference to the foreign key column from B into C
(unlike the HABTM specification), correct?
Better yet, let’s be really explicit.
I am trying to relate Job to TargetList through JobListAssociation.
None of the tables have “traditional” Rails naming conventions except
for the join table which happens to have an “id” column.
class Job < ActiveRecord::Base
has_many :target_lists, :through => :job_list_association,
:foreign_key => :JobReferenceNumber,
:source => :target_list
class TargetList < ActiveRecord::Base
has_many :jobs, :through => :job_list_association,
:foreign_key => :DataSetID,
:source => :job
class JobListAssociation < ActiveRecord::Base
belongs_to :job, :foreign_key => ‘JobReferenceNumber’
belongs_to :target_list, :foreign_key => ‘DataSetID’
When I attempt to call @current_job.target_lists.include? in my view, I
Do I need to add a :condition onto my has_many specification?
Should I always be using symbols instead of strings as hash values in
these ActiveRecord relationship method calls? If so, why?