Sha256: af05c5579a352e22103501652788d26498d46c452095f52c7fe0981f0316152e

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

require 'vostok'
require 'vostok/rails/version'

module Vostok
  module Rails
    def import(columns, values)
      unless connection.is_a? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
        raise NotImplementedError, 'Only PostgreSQL (PG gem) is supported'
      end
      conn = connection.instance_variable_get(:@connection)
      import = Vostok::Import.new(conn)
      import.start(table_name, columns, values)
    end
  end
end

ActiveRecord::Base.extend Vostok::Rails

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vostok-rails-0.0.3 lib/vostok/rails.rb