add missing timestamp and route, set default event_at=Time.now
authorTom Clegg <tom@clinicalfuture.com>
Tue, 22 Jan 2013 22:20:21 +0000 (14:20 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Tue, 22 Jan 2013 22:20:21 +0000 (14:20 -0800)
app/models/log.rb
config/routes.rb
db/schema.rb

index 3b2af893cb32b870fbcb9cbe0c28a49ba8e4c03f..f3ff5ea99acf7aeec37484e6a7e01bec3cf42afe 100644 (file)
@@ -3,6 +3,7 @@ class Log < ActiveRecord::Base
   include KindAndEtag
   include CommonApiTemplate
   serialize :info, Hash
+  before_validation :set_default_event_at
 
   api_accessible :superuser, :extend => :common do |t|
     t.add :object_kind
@@ -12,4 +13,10 @@ class Log < ActiveRecord::Base
     t.add :summary
     t.add :info
   end
+
+  protected
+
+  def set_default_event_at
+    self.event_at ||= Time.now
+  end
 end
index d0e014b940cae2dddf9f40ee562e94f55fa3167f..68f3a2ad12698779ad37099729970a56ed00b7c9 100644 (file)
@@ -1,8 +1,6 @@
 Server::Application.routes.draw do
   resources :logs
-
   resources :projects
-
   resources :specimens
   resources :collections
   resources :metadata
@@ -77,6 +75,7 @@ Server::Application.routes.draw do
       resources :pipelineInvocations
       resources :specimens
       resources :projects
+      resources :logs
       match '/schema' => 'schema#show'
       match '/nodes/:uuid/ping' => 'nodes#ping', :as => :ping_node
       match '/metadata/:tail_kind/:tail' => 'metadata#index'
index 71a06b2f0bcf936abc0890423356ec3c9babafee..9d25e7ee281545767b5cbb438622195b743b626d 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20130122201442) do
+ActiveRecord::Schema.define(:version => 20130122221616) do
 
   create_table "collections", :force => true do |t|
     t.string   "locator"
@@ -47,6 +47,7 @@ ActiveRecord::Schema.define(:version => 20130122201442) do
     t.text     "info"
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.datetime "modified_at"
   end
 
   add_index "logs", ["event_at"], :name => "index_logs_on_event_at"