In_place_editor_field throws error


#1

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.


#2

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 …


#3

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 :frowning:

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.