better caching of variable

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@68 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2007-12-27 06:31:45 +00:00
parent 4c311e40a4
commit d371d2b505
2 changed files with 4 additions and 3 deletions

View File

@ -74,7 +74,7 @@ class Page < ActiveRecord::Base
# #
def set_created_person def set_created_person
self[:created_by] = ApplicationController.current_people_id rescue nil self[:created_by] = ApplicationController.current_people_id rescue nil
self.created_by ||= People.penguincoder self[:created_by] ||= People.penguincoder
end end
## ##
@ -82,7 +82,7 @@ class Page < ActiveRecord::Base
# #
def set_updated_person def set_updated_person
self[:updated_by] = ApplicationController.current_people_id rescue nil self[:updated_by] = ApplicationController.current_people_id rescue nil
self.created_by ||= People.penguincoder self[:updated_by] ||= People.penguincoder
end end
## ##

View File

@ -19,6 +19,7 @@ class People < ActiveRecord::Base
# Finds me. # Finds me.
# #
def self.penguincoder def self.penguincoder
self.find_by_title('PenguinCoder') rescue nil @penguincoder ||= self.find_by_title('PenguinCoder') rescue nil
@penguincoder
end end
end end