You are viewing a plain text version of this content. The canonical link for it is here.
Posted to alois-commits@incubator.apache.org by fl...@apache.org on 2011/02/16 15:25:41 UTC

svn commit: r1071284 - /incubator/alois/trunk/rails/app/models/alarm.rb

Author: flavio
Date: Wed Feb 16 15:25:40 2011
New Revision: 1071284

URL: http://svn.apache.org/viewvc?rev=1071284&view=rev
Log:
Do only include original text in alarm if table has valid primary key

Modified:
    incubator/alois/trunk/rails/app/models/alarm.rb

Modified: incubator/alois/trunk/rails/app/models/alarm.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/app/models/alarm.rb?rev=1071284&r1=1071283&r2=1071284&view=diff
==============================================================================
--- incubator/alois/trunk/rails/app/models/alarm.rb (original)
+++ incubator/alois/trunk/rails/app/models/alarm.rb Wed Feb 16 15:25:40 2011
@@ -229,10 +229,15 @@ class Alarm < ActiveRecord::Base
     @data = datasource
     
     if @data.respond_to?(:table) and @data.table.respond_to?(:report_table)
+      methods = nil
+      tbl = @data.table
+      if tbl.column_names.include?(tbl.primary_key)
+        methods = "original_text"
+      end
       my_data = @data.table.report_table(:all, 
 					 :limit => RECORD_LIMIT, 
 					 :conditions => options[:conditions],
-					 :methods => "original_text"
+					 :methods => methods
 					 )
       log_message("WARNING: Record limit of #{RECORD_LIMIT} reached small for count. " +
 		  "Not all data will be saved!",self) if