# In\_place\_editor\_field problem

**URL:** <https://www.ruby-forum.com/t/in-place-editor-field-problem/109767>\
**Category:** Rails\
**Created:** [July 18, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-problem/109767 "2007-07-18T22:32:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [July 18, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-problem/109767/1 "2007-07-18T22:32:30Z")

</div>

I have a bit of a problem…

I am rendering a table of objects using a partial with a collection of  
those objects. Inside of the partial, I’m trying to use an  
in\_place\_editor\_field tag using the current object form the collection.  
Rails doesn’t seem to like this.

Does in\_place\_editor\_field require a member variable that is set in the  
controller? Since I’m using a variable named after the partial (since  
it is in a collection passed to the partial), is there anyway to get  
those table rows to include in\_place\_editors without re-inventing the  
wheel and writing my own code?

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [July 18, 2007, 11:15pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-problem/109767/2 "2007-07-18T23:15:48Z")

</div>

Dave S. wrote:

> I have a bit of a problem…
> 
> I am rendering a table of objects using a partial with a collection of  
> those objects. Inside of the partial, I’m trying to use an  
> in\_place\_editor\_field tag using the current object form the collection.  
> Rails doesn’t seem to like this.
> 
> Does in\_place\_editor\_field require a member variable that is set in the  
> controller? Since I’m using a variable named after the partial (since  
> it is in a collection passed to the partial), is there anyway to get  
> those table rows to include in\_place\_editors without re-inventing the  
> wheel and writing my own code?

When I did my in\_place\_editor\_field I had to put something like:

in\_place\_edit\_for :user, :first

in the controller. Not sure why this code is required, I would be  
interested to know why myself. I had help when doing my  
in\_place\_edit\_field. I imagine it’s something like a pre-processing  
directive.

~S

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [July 19, 2007, 12:01am UTC](https://www.ruby-forum.com/t/in-place-editor-field-problem/109767/3 "2007-07-19T00:01:03Z")

</div>

> When I did my in\_place\_editor\_field I had to put something like:
> 
> in\_place\_edit\_for :user, :first
> 
> in the controller. Not sure why this code is required

This creates the controller method that the in\_place\_editor\_field  
javascript calls.

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [July 18, 2007, 10:55pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-problem/109767/4 "2007-07-18T22:55:09Z")

</div>

Dave S. wrote:

> Does in\_place\_editor\_field require a member variable that is set in the  
> controller? Since I’m using a variable named after the partial (since  
> it is in a collection passed to the partial), is there anyway to get  
> those table rows to include in\_place\_editors without re-inventing the  
> wheel and writing my own code?

You can just do a \<% @member = my\_thing %\> in the partial.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.
