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
This commit is contained in:
Jean-Philippe Lang 2008-07-20 17:31:11 +00:00
parent be2b8a62f4
commit c39161a6fc
1 changed files with 2 additions and 14 deletions

View File

@ -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