Require error

Hi, I’m getting the following error…

internal:lib/rubygems/custom_require>:28:in `require’: wrong number of
arguments (2 for 1) (ArgumentError)

it corresponds to this line in my code…

require ‘animals’, ‘csv’

Any idea what’s going on?

Paul R. wrote:

Any idea what’s going on?

Require only takes a single argument. If you want to load multiple
files, you need to use multiple calls to “require”

-Justin

On Fri, Oct 8, 2010 at 7:59 PM, Paul R. [email protected]
wrote:

Any idea what’s going on?

You didn’t read the error message.

You handed a method 2 arguments where 1 was expected, so the method
complains about it.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Hello,

internal:lib/rubygems/custom_require>:28:in `require’: wrong number of
arguments (2 for 1) (ArgumentError)

it corresponds to this line in my code…

require ‘animals’, ‘csv’

Any idea what’s going on?

The error message seems pretty clear: ‘require’ is waiting for only
one argument (‘animals’ for example) and you give him two (‘animals’
and ‘csv’). Try two different requirements:

require ‘animals’
require ‘csv’

Cheers,

Thanks all for your replies. I failed to understand the error message.
Thanks for making it clearer to me

Require takes 1 param.

irb(main):011:0> require ‘rubygems’; require ‘active_support’
=> true

irb(main):013:0> require ‘rubygems’, ‘active_support’
ArgumentError: wrong number of arguments (2 for 1)
from
/opt/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require' from /opt/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire’
from
/opt/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
new_constants_in' from /opt/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire’
from (irb):13
from :0
irb(main):014:0>

On 10/8/10 12:59 PM, “Paul R.” [email protected] wrote:

Hi, I’m getting the following error…

internal:lib/rubygems/custom_require>:28:in `require’: wrong number of
arguments (2 for 1) (ArgumentError)

it corresponds to this line in my code…

require ‘animals’, ‘csv’

Any idea what’s going on?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs