More succinct Web#has_page? method

This commit is contained in:
James Herdman 2009-08-29 16:54:50 -04:00
parent af61e78b96
commit 8c1ded2303

View file

@ -61,8 +61,11 @@ class Web < ActiveRecord::Base
pages.last
end
# @param [String] name the name of some potential Page record
# @return [Boolean] whether or not a given Page record exists with a given
# name
def has_page?(name)
Page.count(:conditions => ['web_id = ? AND name = ?', id, name]) > 0
pages.exists?(:name => name)
end
def has_redirect_for?(name)