提交 54a1b0a7 编写于 作者: J Justin

Merge pull request #157 from presidentbeef/fix_single_arg_scopes

Fix scope calls with single arguments
......@@ -153,10 +153,10 @@ The `-c` option can be used to specify a configuration file to use.
The MIT License
Copyright (c) 2010-2012, YELLOWPAGES.COM, LLC
Copyright (c) 2012, Twitter, Inc.
Copyright (c) 2010-2012, YELLOWPAGES.COM, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
......
......@@ -72,6 +72,8 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
model[:options][:scope].each do |args|
second_arg = args[2]
next unless sexp? second_arg
if second_arg.node_type == :iter and node_type? second_arg.block, :block, :call
process_scope_with_block name, args
elsif second_arg.node_type == :call
......
class Account < ActiveRecord::Base
validates_format_of :name, :with => /^[a-zA-Z]+$/
named_scope :all
end
......@@ -21,4 +21,6 @@ class User < ActiveRecord::Base
something = something_helper
where("something = #{something}")
}
scope :all
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册