More succinct Web#last_page method, and documentation

This commit is contained in:
James Herdman 2009-08-29 16:50:09 -04:00
parent b52dee63c3
commit af61e78b96

View file

@ -56,8 +56,9 @@ class Web < ActiveRecord::Base
pages.find_by_name(name) pages.find_by_name(name)
end end
# @return [Page] the last associated Page record
def last_page def last_page
return Page.first(:order => 'id desc', :conditions => ['web_id = ?', self.id]) pages.last
end end
def has_page?(name) def has_page?(name)