ok, I am really pulling my hair out here over something that should be
simple.
(Rails2, In_place_editor plugin)
In my index.html.erb, I have:
<% @tasks.each do |root| %>
- <%= render(:partial => "task_node", :object => root) %>
<% end %>
In my _task_node.html.erb, I have:
<%= in_place_editor_field task_node, ‘description’ %>
<% task_node.children.each do |child| %>
- <%= render(:partial => "task_node", :object => root) %>
<% end %>
I get an error which is
“Called id for nil, which would mistakenly be 4…”
(error comes from line 73 of in_place_macros_helper)
I am using this in the “normal” way successfully elsewhere in my
project.
Thanks in advance before I go bald,
Alan
Mikel,
It is in the code. I got lazy with cut and paste trying to give a
simpler example. Good catch, though!
–Alan
On Thu, Mar 27, 2008 at 11:42 AM, Alan S. [email protected] wrote:
I get an error which is
“Called id for nil, which would mistakenly be 4…”
<% task_node.children.each do |child| %>
> - <%= render(:partial => "task_node", :object => root) %>
><% end %>
Shouldn’t that be :object => child ?
Mikel
On 27 Mar 2008, at 00:42, Alan S. wrote:
<% end %>
In my _task_node.html.erb, I have:
<%= in_place_editor_field task_node, ‘description’ %>
in_place_editor_field is one of the old school helper so it’s
expecting the first parameter to be the name of an instance variable.
A quick and dirty fix would be to put <% @task_node = task_node %> on
the line above and change it to
<%= in_place_editor_field ‘task_node’, ‘description’ %>
Fred
On 27 Mar 2008, at 14:49, Alan S. wrote:
Well, this gets me part of the way there. (although I have to admit,
I don’t understand why.)
it looks like you;ve still got <%= in_place_editor_field task_node,
‘description’ %> in your form instead of <%= in_place_editor_field
‘task_node’, ‘description’ %>
Well, this gets me part of the way there. (although I have to admit,
I don’t understand why.)
However, the HTML generated is:
//<![CDATA[
new
Ajax.InPlaceEditor('#_description_4_in_place_editor',
'/tasks/set_%23%3CTask:0x2b2d504701f0%3E_description/4',
{callback:function(form) { return Form.serialize(form) +
'&authenticity_token=' +
encodeURIComponent('de08c07c32d0105cd81841fc23d2b1ef4d4ea89f') }})
//]]>
Why doesn’t it put the current value of the description in between the
span tags? (since there is no place to click, it isn’t very
helpful…)
Thanks in advance,
Alan
On Thu, Mar 27, 2008 at 9:21 AM, Frederick C.
Thanks, that did it!
–Alan
On Thu, Mar 27, 2008 at 10:15 AM, Frederick C.