X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef7f3d800cbdd49b692df10d312e5fd880e2e938..7377cb63939f8743ca31e67ea3965c2b15d20057:/app/models/acl.rb?ds=sidebyside diff --git a/app/models/acl.rb b/app/models/acl.rb index 0c8996828..095bad89b 100644 --- a/app/models/acl.rb +++ b/app/models/acl.rb @@ -1,9 +1,26 @@ +# == Schema Information +# +# Table name: acls +# +# id :integer not null, primary key +# address :inet +# k :string not null +# v :string +# domain :string +# +# Indexes +# +# acls_k_idx (k) +# + class Acl < ActiveRecord::Base + validates :k, :presence => true + def self.match(address, domain = nil) if domain - condition = Acl.where("address >>= ? OR domain = ?", address, domain) + Acl.where("address >>= ? OR domain = ?", address, domain) else - condition = Acl.where("address >>= ?", address) + Acl.where("address >>= ?", address) end end