While been working on Ruby on Rails application, I was suggested to omit ActiveRecord association intensionally by my coworker for it’s defines unnecessary methods.
Example,
class Person < ActiveRecord::Base
has_many :pets
end
class Pet < ActiveRecord::Base
# belongs_to :person <- Omit belongs_to association, for this is not used in anywhere.
end
I’m confused with this advice, because it’s suggested to define model associations completely on most resources which describes ActiveRecord association.
So, I’d like to ask the practice omitting association like this is valid or not.