All pastes #33704 Raw Edit

Untitled

public text v1 · immutable
#33704 ·published 2005-12-14 22:27 UTC
rendered paste body
class ActivityLog < ActiveRecord::Base
  belongs_to :act

  def self.log(act, detail = nil)
    log = ActivityLog.new
    log.act = act
    log.detail = detail if detail
    log.save
  end
end


class UserLog < ActivityLog
  belongs_to :user

  def self.log(user,act,detail = nil)
    log = UserLog.new
    log.user = user
    log.act = act
    log.detail = detail if detail
    log.save
  end

end

noyb_development=# \d activity_logs
                                        Table "public.activity_logs"
    Column    |            Type             |                           Modifiers
--------------+-----------------------------+---------------------------------------------------------------
 id           | integer                     | not null default nextval('public.activity_logs_id_seq'::text)
 type         | character varying(255)      |
 created_on   | timestamp without time zone |
 act_id       | integer                     |
 user_id      | integer                     |
 pcat_id      | integer                     |
 pcat_view_id | integer                     |
 detail       | character varying(255)      |
Indexes:
    "activity_logs_pkey" PRIMARY KEY, btree (id)