Update ActiveRecord queries to use arel
This commit is contained in:
parent
a543e731c0
commit
226c41be69
20 changed files with 110 additions and 185 deletions
|
@ -1,15 +1,5 @@
|
|||
class Acl < ActiveRecord::Base
|
||||
def self.find_by_address(address, options)
|
||||
self.with_scope(:find => {:conditions => ["#{inet_aton} & netmask = address", address]}) do
|
||||
return self.find(:first, options)
|
||||
end
|
||||
end
|
||||
|
||||
def self.find_all_by_address(address, options)
|
||||
self.with_scope(:find => {:conditions => ["#{inet_aton} & netmask = address", address]}) do
|
||||
return self.find(:all, options)
|
||||
end
|
||||
end
|
||||
scope :address, lambda { |address| where("#{inet_aton} & netmask = address", address) }
|
||||
|
||||
private
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue