From 4a5033b3f898703094d2e842ff777b440289b0ec Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 27 Dec 2007 06:12:15 +0000 Subject: [PATCH] adding default user as myself for all console or backend-generated material git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@66 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7 --- app/models/page.rb | 6 ++++-- db/migrate/007_create_peoples.rb | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/page.rb b/app/models/page.rb index fbbdfae..dd82ab3 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -73,14 +73,16 @@ class Page < ActiveRecord::Base # Sets the People marker for created_by on creation. # def set_created_person - self[:created_by] = ApplicationController.current_people_id + self[:created_by] = ApplicationController.current_people_id rescue nil + self.created_by ||= People.penguincoder end ## # Sets the People marker for updated_by on save. # def set_updated_person - self[:updated_by] = ApplicationController.current_people_id + self[:updated_by] = ApplicationController.current_people_id rescue nil + self.created_by ||= People.penguincoder end ## diff --git a/db/migrate/007_create_peoples.rb b/db/migrate/007_create_peoples.rb index a5fda73..e4ea232 100644 --- a/db/migrate/007_create_peoples.rb +++ b/db/migrate/007_create_peoples.rb @@ -4,6 +4,7 @@ class CreatePeoples < ActiveRecord::Migration t.column :title, :string end People.create :title => 'Guest', :page => Page.new + People.create :title => 'PenguinCoder', :page => Page.new end def self.down