Hi everyone, I am trying to implement the in_place_editor method and am
trying to pass in each item.id as the elementID argument. So I’m trying
to do something like this, <% in_place_editor(‘title_<%=item.id%>’,
:rows => “1”,…) %> But that doesn’t work. Here is my code, http://rafb.net/paste/results/K5yFSG20.html My goal here is to be able
to make this in_place_editor work for each of the items in the list.
Any ideas??
Hi everyone, I am trying to implement the in_place_editor method and am
trying to pass in each item.id as the elementID argument. So I’m trying
to do something like this, <% in_place_editor(‘title_<%=item.id%>’,
:rows => “1”,…) %> But that doesn’t work.
Hi Jeremy, thanks for the reply. I did what you posted and I am getting
an error message saying ‘item’ is undefined. However, it works for
item.id earlier in the code? Any ideas? Sorry I am a noob at rails.
Here is my updated code with error message pasted in below:
Hi everyone, I am trying to implement the in_place_editor method and am
trying to pass in each item.id as the elementID argument. So I’m trying
to do something like this, <% in_place_editor(‘title_<%=item.id%>’,
:rows => “1”,…) %> But that doesn’t work.
Hi Jeremy, thanks for the reply. I did what you posted and I am getting
an error message saying ‘item’ is undefined. However, it works for
item.id earlier in the code? Any ideas? Sorry I am a noob at rails.
Here is my updated code with error message pasted in below:
item is defined as a local block variable earlier on in the code,
that’s why it works there. item is undefined when you use it later.
You may be able to get what you want by moving the sortable_element
and in_place_editor inside the block.
In any case, I’d pick up a good book on Ruby before you go much
further. There’s a free online one at http://www.rubycentral.com/book/. It will explain variable scope
among other important issues.
Hi Jeremy, thanks for the reply. I did what you posted and I am getting
an error message saying ‘item’ is undefined. However, it works for
item.id earlier in the code? Any ideas? Sorry I am a noob at rails.
Here is my updated code with error message pasted in below:
item is defined as a local block variable earlier on in the code,
that’s why it works there. item is undefined when you use it later.
You may be able to get what you want by moving the sortable_element
and in_place_editor inside the block.
In any case, I’d pick up a good book on Ruby before you go much
further. There’s a free online one at http://www.rubycentral.com/book/. It will explain variable scope
among other important issues.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.