summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-20 17:31:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-20 17:31:11 +0000
commitc39161a6fc61ab0b324f48bae41832f1a69efeae (patch)
tree8a8ff07b5891049f66e10da2e940c087a72691c2
parentbe2b8a62f4d0d8bf413a5583fe644bd41a8ebf04 (diff)
downloadredmine-c39161a6fc61ab0b324f48bae41832f1a69efeae.tar.gz
redmine-c39161a6fc61ab0b324f48bae41832f1a69efeae.zip
Fixed: searchable model can't be loaded if table is not yet created (#1421).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1682 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb16
1 files changed, 2 insertions, 14 deletions
diff --git a/vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index fec933352..9ec0e7d6f 100644
--- a/vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -41,20 +41,8 @@ module Redmine
searchable_options[:columns] = [] << searchable_options[:columns]
end
- if searchable_options[:project_key]
- elsif column_names.include?('project_id')
- searchable_options[:project_key] = "#{table_name}.project_id"
- else
- raise 'No project key defined.'
- end
-
- if searchable_options[:date_column]
- elsif column_names.include?('created_on')
- searchable_options[:date_column] = "#{table_name}.created_on"
- else
- raise 'No date column defined defined.'
- end
-
+ searchable_options[:project_key] ||= "#{table_name}.project_id"
+ searchable_options[:date_column] ||= "#{table_name}.created_on"
searchable_options[:order_column] ||= searchable_options[:date_column]
# Permission needed to search this model