Check
Check a controller file to make sure that complex model creation should not exist in controller, move it to model factory method
Implementation: check the count of variable attribute assignment calling before saving, if more than defined attribute assignment count, then it’s a complex creation.
# File lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb, line 24 def evaluate_start(node) @variables = {} node.recursive_children do |child| case child.node_type when :attrasgn attribute_assignment(child) when :call call_assignment(child) else end end @variables = nil end
Generated with the Darkfish Rdoc Generator 2.