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.
Well, the problem is probably that
argsis 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.