How to use in_place_editor_field?

Hello, I really don’t understand how to use in_place_editor_field

In my controller :
class Admin::CategoriesController < Admin::BaseController
in_place_edit_for :category, :title

def list
@categories = Category.find_all
end

end

In the view list.rhtml
<% @categories.each do |c| %>

<%= in_place_editor_field :c, c.title %> # snip <% end %>

I get error
Called id for nil, which would mistakenly be 4 – if you really wanted
the id of nil, use object_id

I’ve tried
in_place_editor_field :c, ‘title’
in_place_editor_field :c, :title
in_place_editor_field :c, ‘c.title’

nothing work, what is the right syntax ?

Thank you


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

I have the exact same result when I try.

Called id for nil, which would mistakenly be 4 – if you really wanted
the id of nil, use object_id

Is there some documentation on this somewhere? We must obviously be
using it wrong…

-Andy

Andrew D. Goodfellow wrote:

I have the exact same result when I try.

Called id for nil, which would mistakenly be 4 – if you really wanted
the id of nil, use object_id

Is there some documentation on this somewhere? We must obviously be
using it wrong…

-Andy

Okay, I found it but it’s really really weird

<% @categories.each do |c| %>
<%= @category = c; in_place_editor_field :category, :title %>

snip

<% end %>

Or may we might write ?
<% @categories.each do |@c| %>
<%= in_place_editor_field :c, :title %>

snip

<% end %>

Didn’t tried the last one

I really don’t understand why a local object instance doesn’t do the job