More succinct Web#page method and documentation

This commit is contained in:
James Herdman 2009-08-29 16:23:41 -04:00
parent 09531ce777
commit b52dee63c3

View file

@ -49,8 +49,11 @@ class Web < ActiveRecord::Base
select.map { |page| page.categories }.flatten.uniq.sort select.map { |page| page.categories }.flatten.uniq.sort
end end
# @param [String] name the name of some associated Page record to find
# @return [Page, nil] the associated Page record, or +nil+ if no record is
# found with the provided name
def page(name) def page(name)
pages.first(:conditions => ['name = ?', name]) pages.find_by_name(name)
end end
def last_page def last_page