user8755767
user8755767

Reputation:

In place editing rails

I receive an error wrong number of arguments (given 1, expected 2..3) how can i apply it in a each loop ? I want to be able to edit it inplace in an each loop

  <%= best_in_place s.message %>

application.js

//= require jquery_ujs
//= require jquery.purr

user.coffee

jQuery ->
 $('.best_in_place').best_in_place() 

version best_in_place 3.1.1

OR

Is there a more better way of implementing an inplace editing

Upvotes: 1

Views: 254

Answers (1)

Sebasti&#225;n Palma
Sebasti&#225;n Palma

Reputation: 33460

best_in_place(object, field, opts = {})

See the arguments the best_in_place method expects to receive. You're passing only one.

  • object means an object or specific record.
  • field is the attribute which to edit - in your case it could be message.
  • options all the options it accepts.

Most probably you need something like:

<%= best_in_place @object, :message, as: :input %>

Upvotes: 1

Related Questions