# How to use in\_place\_editor\_field?

**URL:** <https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804>\
**Category:** Rails\
**Created:** [April 4, 2006, 9:58am UTC](https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804 "2006-04-04T09:58:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [April 4, 2006, 9:58am UTC](https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804/1 "2006-04-04T09:58:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [April 4, 2006, 10:35am UTC](https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804/2 "2006-04-04T10:35:31Z")

</div>

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [April 4, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804/3 "2006-04-04T18:34:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [April 4, 2006, 7:33pm UTC](https://www.ruby-forum.com/t/how-to-use-in-place-editor-field/56804/4 "2006-04-04T19:33:36Z")

</div>

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
