Check to make sure not avoid the law of demeter.
Implementation:
check all models to record belongs_to associations
check if calling belongs_to association’s method or attribute
# File lib/rails_best_practices/checks/law_of_demeter_check.rb, line 21 def evaluate_start(node) if node.node_type == :class remember_belongs_to(node) elsif [:lvar, :ivar].include?(node.subject.node_type) and node.subject != s(:lvar, :_erbout) add_error "law of demeter" if need_delegate?(node) end end
Generated with the Darkfish Rdoc Generator 2.