# In\_place\_editor\_field throws error

**URL:** <https://www.ruby-forum.com/t/in-place-editor-field-throws-error/56172>\
**Category:** Rails\
**Created:** [March 28, 2006, 4:00pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-throws-error/56172 "2006-03-28T16:00:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [March 28, 2006, 4:00pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-throws-error/56172/1 "2006-03-28T16:00:57Z")

</div>

I receive the following error:  
Called id for nil, which would mistakenly be 4 – if you really wanted  
the id of nil, use object\_id

when trying to use the in\_place\_editor\_field tag:

\<% for employee in @employees %\>  
\<%= in\_place\_editor\_field :employee, employee.fname %\>  
\<% end %\>

My model is called Employee and is being populated from a controller  
method employees\_list:

@employees = Employee.find\_all

When I take the \<%= in\_place\_editor\_field :employee, employee.fname %\>  
out everything is back to normal.

ANy ideas, I have performed a search but no luck.

---

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [April 5, 2006, 10:08pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-throws-error/56172/2 "2006-04-05T22:08:27Z")

</div>

Did you have any luck in finding the solution to your problem?

In fact I’m stuck at your same point and the email sent to the list  
later on didn’t help too much. In particular I don’t get an error when  
using the following form:

\<% for task in @tasks %\>  
\<%= state\_class(task.state\_id) %\> align=‘left’\>\<%= @task = task;  
in\_place\_editor\_field :task , :body %\>  
\<% end %\>

But the resulting field in still _not_ editable …

---

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [April 5, 2006, 10:11pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-throws-error/56172/3 "2006-04-05T22:11:31Z")

</div>

Ugh! In a few minutes I found the solution in another (older) mail in  
the list:

"Make sure you have  
\<%= javascript\_include\_tag :defaults %\>

in your page/layout’s head."

It turns out I had not included the above ☹

Sorry to the list members for having posted maybe too quickly. In any  
case, I’m posting this for someone who may encounter this issue in the  
future.
