Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ArgumentError when using TinymceSpellcheck

I want to use 'tinymce_spellcheck' to use the spellcheck button in my tinymce editor. I wrote in my controller:

def spellcheck
  data = ActiveSupport::JSON.decode(request.raw_post)
  args = data['params'].to_a.first
  spellcheck = TinymceSpellcheck.new({}, :raspell)
  result = spellcheck.send(data['method'].underscore,*args)  #****---- THIS LINE****
  render :json => { :id => data['id'], :result => result, :error => nil }.to_json
end 

I get the following error message:

ArgumentError (wrong number of arguments (1 for 2)):
app/controllers/members_controller.rb:127:in `spellcheck'

Would you be so kind to tell me how to solve this problem? I am providing two arguments and, yet, I get the same error message again and again.

like image 507
user1766346 Avatar asked Jun 11 '26 20:06

user1766346


1 Answers

Well, the problem is probably that args is empty or nil, so when you call the splat on it, it turns into zero arguments. Thus, your only argument is the 'method', and you get an ArgumentError.

like image 72
MrTheWalrus Avatar answered Jun 14 '26 10:06

MrTheWalrus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!