]> git.openstreetmap.org Git - rails.git/blob - app/models/acl.rb
Make more use of named scopes
[rails.git] / app / models / acl.rb
1 class Acl < ActiveRecord::Base
2   scope :address, lambda { |address| where("#{inet_aton} & netmask = address", address) }
3
4 private
5
6   def self.inet_aton
7     if self.connection.adapter_name == "MySQL"
8       "inet_aton(?)"
9     else
10       "?"
11     end
12   end
13 end