Keep receiving: wrong number of arguments (2 for 0)

Hello all,

I can’t understand why the following code keeps throwing the wrong
number of arguments error. Even if I leave the function empty it still
throws the error. What am I doing wrong?

class SmsController < ApplicationController
def send
if params[:send] == “true”
account = Twilio::RestAccount.new(TWILIO_CONFIG[‘ACCOUNT_SID’],
TWILIO_CONFIG[‘ACCOUNT_TOKEN’])

   d = {
     'From' => TWILIO_CONFIG['CALLER_ID'],
     'To'  => '1234567,
     'Body'  => 'Testing'
   }

   @resp = account.request("/#{TWILIO_CONFIG['API_VERSION']}/

Accounts/#{TWILIO_CONFIG[‘ACCOUNT_SID’]}/SMS/Messages", ‘POST’, d)

   @resp.error! unless @resp.kind_of? Net::HTTPSuccess
 end

end
end

Kenneth L. wrote in post #983961:

Hello all,

I can’t understand why the following code keeps throwing the wrong
number of arguments error. Even if I leave the function empty it still
throws the error. What am I doing wrong?

class SmsController < ApplicationController
def send

Use a different method name than ‘send’ That’s a Ruby reserved word.

On 25 February 2011 17:30, Kenneth L. [email protected] wrote:

I can’t understand why the following code keeps throwing the wrong
number of arguments error. Even if I leave the function empty it still
throws the error. What am I doing wrong?

Which line?

On Feb 25, 5:30pm, Kenneth L. [email protected] wrote:

Hello all,

I can’t understand why the following code keeps throwing the wrong
number of arguments error. Even if I leave the function empty it still
throws the error. What am I doing wrong?

You’re overwriting a core ruby method (send)

Fred

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