Search code examples
ruby-on-railsajaxx-editable

Why is xeditable PUTting to edit action?


I'm using the bootstrap-sass and x-editable-rails gems in my rails application.

I have the following line in my show.html.haml:

= editable @article, :title

It's generating html that looks like:

<span class="editable editable-click" title="Title" data-type="text" data-model="article" data-name="title" data-value="another!!!!" data-placeholder="Title" data-url="/articles/3">another!!!!</span>

Why is it when the field is submitted that it's sending a PUT request to /articles/3/edit when the data-url is explicitly set to /articles/3?

How do I get it to PUT at /articles/3?


Solution

  • I figured it out!

    The field was correctly sending the request to /articles/3, which was being handled by the update action. But then I had a redirect to the edit action, which I guess was causing the problem. I'm not sure why it still ended up being a PUT request on the redirect. In any case, the routes weren't set up to handle that.