bootstrap-ruby / bootstrap-editable-rails

In-place editing with Twitter Bootstrap for Rails
http://rubygems.org/gems/bootstrap-editable-rails
MIT License
216 stars 52 forks source link

Add option to define the REST Method. #2

Closed marcosgugs closed 11 years ago

marcosgugs commented 11 years ago

I added an option to change the method REST, required to create new records.

tkawa commented 11 years ago

Thank you.

POST method is certainly required to create a new record.

By the present spec, a new value is always submitted because options.url is overwritten. Therefore, new record creation is insufficient only by POST.

You can change the HTTP method in either of the following ways, though.

<a href="#" id="username" data-ajax-options='{"type": "POST"}' data-type="text" data-resource="post" data-name="username" data-url="/posts/1" data-original-title="Enter username">superuser</a>

or

$('#username').editable({
  ajaxOptions: { type: 'POST' }
});

I'm going to think of a better spec for creating new record.