incubator-alois-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fla...@apache.org
Subject svn commit: r1071284 - /incubator/alois/trunk/rails/app/models/alarm.rb
Date Wed, 16 Feb 2011 15:25:41 GMT
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



Mime
View raw message