Is is possible to do? I'm kinda lost with this.
I'm trying to add some functionality to a Ruby on Rails 3.2 app that I did not develop but I am confused with the model definitions.
Here is and example:
class Indicator < ActiveRecord::Base
#attr_accessible :name, :objective_ids, :weight, :operation_id, :objective_id, :unit, :formula, :acronym
attr_protected
has_and_belongs_to_many :objectives
has_many :indicator_scores
has_many :indicatorscores, :class_name => 'IndicatorScore', :foreign_key => "scoredate_id"
belongs_to :operation
belongs_to :objective
has_and_belongs_to_many :sons, :join_table => "indicator_father_son", :class_name => "Indicator", :foreign_key => "indicatorfather_id", :association_foreign_key => "indicatorson_id"
end
In this Model, specially on the has_and_belongs_to_many option I have crossed thoughts because the table "indicator_father_son" doesn't have a model.
Is this legal in Ruby on Rails MVC convention?
What does the has_and_belongs_to_many clause with all the options exactly do? and why is it necessary?
I can provide more code if the model show is not enough to grasp the issue.
Thanks in advance for any help.