Sha256: f005f59f1829e70f5a6a7707c948b2dc121c3a0f512be320e05259a73b85cecf

Contents?: true

Size: 329 Bytes

Versions: 1

Compression:

Stored size: 329 Bytes

Contents

class ActiveRecord::Base
  class << self
    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  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
import-0.0.3 lib/import/importable.rb