Questions tagged [argument-error]

Use this tag when you have problems passing in arguments to a function

An argument error is a common error when using functions with arguments. Such error may include "some argument is missing", "some argument does not match required data type", "the number of provided arguments does not match that needed by the function", etc.

83 questions
93
votes
6 answers

Rails: Invalid byte sequence in US-ASCII (Argument Error) when I run rake db:seed

When I run rake db:seed in my Rails app, I'm getting this error: invalid byte sequence in US-ASCII (Argument Error) I just added science_majors and down to my seed file, and now when I run rake db:seed it gives me this error: invalid byte…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
43
votes
4 answers

Argument Error: The scope body needs to be callable

I'm working through the 'Ruby On Rails 3 Essential Training' and have received a problem when using name scopes. When finding records and using queries withing the Rails console everything went smoothly until I tried to use a name scope in my…
Sam Gruse
  • 488
  • 1
  • 5
  • 11
22
votes
2 answers

Ruby `split': invalid byte sequence in UTF-8 (ArgumentError)

I am trying to populate the movie object, but when parsing through the u.item file I get this error: `split': invalid byte sequence in UTF-8 (ArgumentError) File.open("Data/u.item", "r") do |infile| while line = infile.gets …
kashive
  • 1,356
  • 2
  • 11
  • 17
10
votes
1 answer

How does one use delayed_job to make an Rails 3.0 ActionMailer run asynchronously? Encountering ArgumentErrors

I'm trying to delay a notification email to be sent to users upon signing up to my app. The emails are sent using an ActionMailer which I call InitMailer. The way I am trying to delay the jobs is using collectiveidea's delayed_job…
geb2011
  • 461
  • 5
  • 15
10
votes
5 answers

minitest_plugin.rb:9 getting wrong number of arguments

~/Sites/sample_app$ rails test Running via Spring preloader in process 24338 Run options: --seed 58780 Running: .. Finished in 0.292172s, 6.8453 runs/s, 6.8453…
Josh HUmphrey
  • 273
  • 2
  • 10
9
votes
1 answer

Rails 3.2.13 / Devise 2.2.3: Method "authenticate_scope!" throws error: wrong number of arguments (1 for 0)

I use Devise (2.2.3) and am trying to load the "edit" form for a user using this jQuery ajax call: $.ajax({ type: 'GET', url: '/users/edit', data: { id: id } }); This will call this before_filter... prepend_before_filter…
TomDogg
  • 3,803
  • 5
  • 33
  • 60
9
votes
2 answers

Why does a range with invalid arguments sometimes not cause an argument error?

The following code causes an argument error: n = 15 (n % 4 == 0)..(n % 3 == 0) # => bad value for range (ArgumentError) which I think is because it evaluates to: false..true and different types of classes are used in range: TrueClass and…
yaru
  • 1,260
  • 1
  • 13
  • 29
8
votes
2 answers

Rails : wrong number of arguments (1 for 0) for .new

I have this error when I try to create a Review object : ArgumentError in ReviewsController#create wrong number of arguments (1 for 0) app/controllers/reviews_controller.rb:17:in `new' app/controllers/reviews_controller.rb:17:in `create' I don't…
Kilian
  • 579
  • 3
  • 19
4
votes
1 answer

Flash Error #1063 Argument count mismatch

I'm getting the following strange error: ArgumentError: Error #1063: Argument count mismatch on Away3DLiteSprite(). Expected 4, got 0.
Apollon1954
  • 1,388
  • 4
  • 16
  • 33
3
votes
2 answers

Builder throwing "wrong number of arguments" error when passed a block in Ruby 1.9

I'm trying to upgrade a Ruby 1.8 app to 1.9 and hit a bit of a roadblock here. In Ruby 1.8.7, I can pass on a block to Builder 3.0.0 and it gets called as expected: 1.8.7 :003 > @builder = Builder::XmlMarkup.new 1.8.7 :004 > block = lambda { puts…
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
3
votes
1 answer

Accessing arbitrary rows in Julia matrix

I have the following code, where given i I want to find the ith row of a matrix. My code is the following: function f(mat,i) println(mat[:i,:]) end However, I get the following error: ArgumentError: invalid index: :i of type Symbol I have…
newtothis
  • 495
  • 3
  • 10
3
votes
1 answer

Gets.chomp input comparison returning an error

I AM USING RUBY ERROR: comparison of Integer with String failed (ArgumentError) puts "Age: " age = gets.chomp if 0 < age < 130 I want the programm to allow the user to input all the numbers between 0 (not included) and 130 (included). How…
Onionixed
  • 63
  • 1
  • 1
  • 10
3
votes
1 answer

Ruby on Rails 5.0 upgrade not working with rails console or db:migrate

After recently upgrading to Ruby on Rails 5.0 from 4.2, I have been unable to run rake db:migrate, or rails console. I think it best to solve the console error first and it seems to give the followin more informative errors: Here is the full stack…
March
  • 55
  • 1
  • 7
2
votes
2 answers

Calculate Tanimoto coefficient for dataframe

I have a table that looks like this: and I want to calculate Tanimoto coefficient (Molecular similarity measure) by RDkit in python in order to have below result: but I failed. My data: {'name': ['16β-hydro-ent-kauran-17-oic acid ', …
jacobdavis
  • 35
  • 6
2
votes
0 answers

ArgumentError (wrong number of arguments (given 2, expected 1)) upgrade to rails 6.1.3.2 / ruby 3.0.0

Below code has been failing while upgrading to rails 6.1.3.2 from rails 5.2.3 Project.all.each do |project| define_method("is_#{project.name}?".to_sym) { User.current_user.try(:projects) && User.current_user.projects.include?(Project.where(name:…
1
2 3 4 5 6