Update ActiveRecord queries to use arel

This commit is contained in:
Tom Hughes 2010-09-09 10:56:19 +01:00
parent a543e731c0
commit 226c41be69
20 changed files with 110 additions and 185 deletions

View file

@ -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