Parent

Files

RailsBestPractices::Checks::NotUseDefaultRouteCheck

Check config/routes to make sure not use default route that rails generated.

Implementation: compare route sentence to see if it is equal to rails default route.

Public Instance Methods

evaluate_start(node) click to toggle source
# File lib/rails_best_practices/checks/not_use_default_route_check.rb, line 18
def evaluate_start(node)
  if node == s(:call, s(:lvar, :map), :connect, s(:arglist, s(:str, ":controller/:action/:id"))) or
     node == s(:call, s(:lvar, :map), :connect, s(:arglist, s(:str, ":controller/:action/:id.:format")))
    add_error "not use default route"
  end
end
interesting_files() click to toggle source
# File lib/rails_best_practices/checks/not_use_default_route_check.rb, line 14
def interesting_files
  /config\/routes.rb/
end
interesting_nodes() click to toggle source
# File lib/rails_best_practices/checks/not_use_default_route_check.rb, line 10
def interesting_nodes
  [:call]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.