# In\_place\_edit\_field help

**URL:** <https://www.ruby-forum.com/t/in-place-edit-field-help/196443>\
**Category:** Rails\
**Created:** [August 22, 2007, 4:50am UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443 "2007-08-22T04:50:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 22, 2007, 4:50am UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/1 "2007-08-22T04:50:28Z")

</div>

Hello, i got this:

site\_controller  
Menu.content\_columns.each do |column|  
in\_place\_edit\_for :menu, column.name  
end

:menu, is a model with the sections names and contents

In my view i have:  
\<%= in\_place\_editor\_field “dataCenter”,  
‘content’,{},{:rows=\>8,:cols=\>5}%\>

and it says:

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

Extracted source (around line #1):  
1: \<%= in\_place\_editor\_field “dataCenter”,  
‘content’,{},{:rows=\>8,:cols=\>5}%\>

IF I PUT  
\<%= in\_place\_editor “dataCenter”, ‘content’,{}%\>, it does the work but  
without the size i want, i mean it just present all the data in a field.

Any helps will be good,  
Regards,

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 22, 2007, 3:54pm UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/2 "2007-08-22T15:54:24Z")

</div>

I believe you need to swap your options around and send the size through  
the tag\_options not editor\_options like this:

\<%= in\_place\_editor\_field  
“dataCenter”,‘content’,{:rows=\>8,:cols=\>5},{}%\>

Edgar G. wrote:

> \<%= in\_place\_editor\_field “dataCenter”,
> 
> IF I PUT  
> \<%= in\_place\_editor “dataCenter”, ‘content’,{}%\>, it does the work but  
> without the size i want, i mean it just present all the data in a field.
> 
> Any helps will be good,  
> Regards,

–  
Sincerely,

William P.

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 22, 2007, 4:03pm UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/3 "2007-08-22T16:03:25Z")

</div>

actually, you can leave the last ar out completely (still on first cup  
of coffee 🙂

\<%= in\_place\_editor\_field “dataCenter”,‘content’, :rows=\>8, :cols=\>5 %\>

William P. wrote:

> > \<%= in\_place\_editor “dataCenter”, ‘content’,{}%\>, it does the work but  
> > without the size i want, i mean it just present all the data in a field.
> > 
> > Any helps will be good,  
> > Regards,

–  
Sincerely,

William P.

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 23, 2007, 12:56am UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/4 "2007-08-23T00:56:31Z")

</div>

Hey!, thanks for your answers, but i still get this message: ☹

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

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 23, 2007, 3:29am UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/5 "2007-08-23T03:29:36Z")

</div>

If you use this the in-place editor is looking for a variable called  
@dataCenter. Did you come from Java? The ruby conventions is  
data\_center as a variable name. I’m guessing you are inside of a  
partial that you are passing a collection? So your partial is  
creating a variable called dataCenter. So just add a line above your  
current line. Like this:

\<% @dataCenter = dataCenter %\>  
\<%= in\_place\_editor\_field “dataCenter”,‘content’, :rows=\>8, :cols=\>5 %\>

You may also want to change dataCenter into a symbol, like :dataCenter.

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 23, 2007, 4:05am UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/6 "2007-08-23T04:05:34Z")

</div>

hey! thanks Amos, it was because i was in a parcial,  
but could you explain me why i had to do the \<% @dataCenter = dataCenter  
%\>??

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [August 23, 2007, 3:29pm UTC](https://www.ruby-forum.com/t/in-place-edit-field-help/196443/7 "2007-08-23T15:29:38Z")

</div>

When you use a collections partial it takes each item in the  
collection and passes it to a variable with the same name as your  
partial. ie;

I have a variable called @items that is an array of Item(s)

\<%= render :partial =\> ‘item’, :collection =\> @items %\>

Inside the partial now there is an variable called item.  
Now I have the following in my partial:

\<%= in\_place\_editor :item, “name” %\>

The in-place editor isn’t looking for item, but is looking for @item.  
I believe that this should be changed, but that is the way it was  
made. So above that line I have to create @item so that in-place  
editor can use it.

If I was writing a function the collections partial would have a  
signature like this:

render( partial, collection )

The variable partial is what is used as your variable name in the  
partial you created.

Now the in-place-editor is looking for @partial. I hope that doesn’t  
confuse you.

-Amos

On 8/22/07, Edgar G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## hey! thanks Amos, it was because i was in a parcial, but could you explain me why i had to do the \<% @dataCenter = dataCenter %\>??
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

## – Amos K. A. King Software Development and Consulting, L.C. [http://dirtyInformation.com](http://dirtyInformation.com)

Looking for something to do? Visit [http://ImThere.com](http://ImThere.com)
