Parent

Files

RailsBestPractices::Checks::AddModelVirtualAttributeCheck

Check a controller to make sure adding a model virual attribute to simplify model creation.

Implementation: check arguments of params#[]= before calling save, if they have duplicated arguments, then the model may need to add a model virtual attribute.

Public Instance Methods

evaluate_start(node) click to toggle source
# File lib/rails_best_practices/checks/add_model_virtual_attribute_check.rb, line 19
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
interesting_files() click to toggle source
# File lib/rails_best_practices/checks/add_model_virtual_attribute_check.rb, line 15
def interesting_files
  CONTROLLER_FILES
end
interesting_nodes() click to toggle source
# File lib/rails_best_practices/checks/add_model_virtual_attribute_check.rb, line 11
def interesting_nodes
  [:defn]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.