lib/ixtlan/audit/resource.rb in ixtlan-audit-0.3.3 vs lib/ixtlan/audit/resource.rb in ixtlan-audit-0.4.0
- old
+ new
@@ -22,17 +22,27 @@
module Ixtlan
module Audit
class Audit
include DataMapper::Resource
+ def self.storage_name(arg)
+ 'ixtlan_audits'
+ end
+
property :id, Serial
- property :login, String
- property :path, String
- property :message, String
-
+ property :login, String, :length => 32
+ property :http_method, String, :length => 8, :field => 'method'
+ property :path, String, :length => 64
+ property :message, String, :length => 192
property :created_at, DateTime
+ if defined?( ::User ) && ::User.respond_to?( :properties ) # DataMapper
+ belongs_to :created_by, ::User, :required => false
+ elsif defined?( Ixtlan::UserManagement::User ) && Ixtlan::UserManagement::User.respond_to?( :properties ) # DataMapper
+ belongs_to :created_by, Ixtlan::UserManagement::User, :required => false
+ end
+
before :save do
self.created_at = DateTime.now
end
def to_s