Kenneth Lorthioir
2011-Feb-25 17:30 UTC
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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2011-Feb-25 19:59 UTC
Re: Keep receiving: wrong number of arguments (2 for 0)
On 25 February 2011 17:30, Kenneth Lorthioir <ibelimb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Feb-25 19:59 UTC
Re: Keep receiving: wrong number of arguments (2 for 0)
On Feb 25, 5:30 pm, Kenneth Lorthioir <ibel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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> 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) > > -J5QpyHNMTsDF2uMehF1BdA@public.gmane.org! unless @resp.kind_of? Net::HTTPSuccess > end > end > end-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker
2011-Feb-25 19:59 UTC
Re: Keep receiving: wrong number of arguments (2 for 0)
Kenneth Lorthioir 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 sendUse a different method name than ''send'' That''s a Ruby reserved word. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.