Activerecord-import gem NoMethodError: undefined method 'import'

I am trying to use the activerecord-import attribute, and I have been following the wiki directions, but I am getting NoMethodError: undefined method 'import' for #<Class:0x8b009b0>. Here is my code (basically the same as the wiki example)

    class ExampleCode
      def self.testing
        orders = []
        10.times do |i|
          orders << Order.new(:raw_data => "order #{i}")
        end

        Order.import orders

      end
    end

I call the method as follows:

ExampleCode.testing

I tried on windows, linux, with sqlite database, with mysql database and still no luck. And I'm sure I have a gem installed:

actionmailer (3.2.6, 3.2.3, 3.2.1, 3.2.0)
actionpack (3.2.6, 3.2.3, 3.2.1, 3.2.0)
activemodel (3.2.6, 3.2.3, 3.2.1, 3.2.0)
activerecord (3.2.6, 3.2.3, 3.2.1, 3.2.0)
activerecord-import (0.2.10)
activerecord-oracle_enhanced-adapter (1.4.1)
activerecord-sqlserver-adapter (3.2.1)....

I even tried to use require (which should not be necessary when the pearls are installed. I did not see this occur anywhere else, so I am afraid that I should miss something very obvious

+5
source share
1 answer

active_record activerecord-import

.

require active_record
require activerecord-import

( )

, Ruby , . , Gemfile .

+1

All Articles