bernat/best_in_place — pull request #300 by shaabans (2013-09-21 23:14:16+00:00)
Title: Rails 4

Hello,

I'd like to be able to use best_in_place for creating new objects as well as the usual update of existing objects, by just invoking the best_in_place helper on a new unsaved object.

My modification here just changes the AJAX data's method from PUT to POST if no ID is supplied in the data-url attribute (which is what happens on an unsaved objected with no ID). This performs half the job, but does not update the data-url attribute of the element after it is added, so further in-place updates without a reload fail.

Could you check out my update and provide some guidance on the best way to update the data-url once a new object is created?

Much thanks for an advice and for the great plugin.

- Sam