Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionDispatch::Http::Parameters::ParseError #354

Closed
PavloBezpalov opened this issue Feb 14, 2020 · 1 comment
Closed

ActionDispatch::Http::Parameters::ParseError #354

PavloBezpalov opened this issue Feb 14, 2020 · 1 comment

Comments

@PavloBezpalov
Copy link
Contributor

PavloBezpalov commented Feb 14, 2020

Hi. When i try to use POST like described in readme

$ ->
  $('#posts-datatable').dataTable
    ajax:
      url: $('#posts-datatable').data('source')
      contentType: 'application/json'
      type: 'POST'
    # ...others options, see [here](#5-wire-up-the-javascript)

i got error in Rails ActionDispatch::Http::Parameters::ParseError

So i tried to format params in json like this

$ ->
  $('#posts-datatable').dataTable
    ajax:
      url: $('#posts-datatable').data('source')
      contentType: 'application/json'
      type: 'POST'
      data: (d) ->
        JSON.stringify d

But I got NoMethodError: undefined method to_unsafe_h' for #<Array at ajax-datatables-rails-1.1.0/lib/ajax-datatables-rails/datatable/datatable.rb:73:in get_param'

@PavloBezpalov
Copy link
Contributor Author

Found solution. I should not use contentType: 'application/json' in first example :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant