Forum: Ruby on Rails IN-PLACE FORM EDITING

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rob B. (Guest)
on 2006-04-18 20:45
Ive been following the rails recipes (great book) and wanted to have a
larger a text field when editing in place.

The chapter it mentions that I can  "force the InPlaceEditor to create
either a text field or a <textarea> field, using the :rows option to
in_place_editor_field( ). Then any value greater than 1 will tell
InPlaceEditor to generate a <textarea>."  It doesn't elaborate and Im
not sure on the correct way to write it.

I presume you just have to update the view file only (i might be wrong)

my view is -

<% for column in Contact.content_columns %>

<p>

  <%= in_place_editor_field :contact, column.name%>
</p>
<% end %>
<%= link_to ' Back' , :action => ' list' %>
François B. (Guest)
on 2006-04-18 21:05
(Received via mailing list)
Hello Rob,

2006/4/18, Rob B. <removed_email_address@domain.invalid>:
>   <%= in_place_editor_field :contact, column.name%>

The options go after the column, so in your case, you'd do it this way:
<%= in_place_editor_field :contact, column.name, :rows => 2, :cols => 50
%>

If you go to the Rails API at http://api.rubyonrails.com/, you can
find the declaration of #in_place_editor_field, and take it from
there.

Hope that helps !
Rob B. (Guest)
on 2006-04-18 21:55
François Beausoleil wrote:
> Hello Rob,
>
> 2006/4/18, Rob B. <removed_email_address@domain.invalid>:
>>   <%= in_place_editor_field :contact, column.name%>
>
> The options go after the column, so in your case, you'd do it this way:
> <%= in_place_editor_field :contact, column.name, :rows => 2, :cols => 50
> %>
>
> If you go to the Rails API at http://api.rubyonrails.com/, you can
> find the declaration of #in_place_editor_field, and take it from
> there.
>
> Hope that helps !

Thanks.  I thought that would work but the boxes are still one line.
Andrew R. (Guest)
on 2006-04-19 02:02
(Received via mailing list)
Rob B. wrote:

> François Beausoleil wrote:

[...]

>> The options go after the column, so in your case, you'd do it this way:
>> <%= in_place_editor_field :contact, column.name, :rows => 2, :cols => 50
>> %>

[...]

> Thanks.  I thought that would work but the boxes are still one line.

That's because in_place_editor_field takes *two* hashes in its
parameter list.  You have to specify which one.

Try this:

  <%= in_place_editor_field :foo, :bar, {}, {:rows => 4, :cols => 75} %>

-Drew
BenJamin Prater (Guest)
on 2006-04-29 01:59
(Received via mailing list)
It's unfortunate that the API doesn't give enough information to
understand this -- and a person has to ask on list for answers.

The API:

> in_place_edit_for(object, attribute, options = {})

The answer:

> <%= in_place_editor_field :foo, :bar, {}, {:rows => 4, :cols => 75} %>

Ben
This topic is locked and can not be replied to.