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
pull/351/head
Jean-Philippe Lang 17 years ago
parent be2b8a62f4
commit c39161a6fc
  1. 16
      vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb

@ -41,20 +41,8 @@ module Redmine
searchable_options[:columns] = [] << searchable_options[:columns] searchable_options[:columns] = [] << searchable_options[:columns]
end end
if searchable_options[:project_key] searchable_options[:project_key] ||= "#{table_name}.project_id"
elsif column_names.include?('project_id') searchable_options[:date_column] ||= "#{table_name}.created_on"
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[:order_column] ||= searchable_options[:date_column] searchable_options[:order_column] ||= searchable_options[:date_column]
# Permission needed to search this model # Permission needed to search this model

Loading…
Cancel
Save