Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/import/importable.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.find_existing_entries(criteria, values) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/import/importable.rb', line 3 def find_existing_entries(criteria, values) class_eval <<-EOV find_by_sql( [ "SELECT #{self.table_name}.id AS id, #{self.table_name}.name AS name FROM #{self.table_name} WHERE #{criteria}", "#{values.join('", "')}" ] ).map{|a| [a.id, a.name]} EOV end |