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 ?eld or a <textarea> ?eld, using the :rows option to in_place_editor_?eld( ). 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'' %> -- Posted via http://www.ruby-forum.com/.
Hello Rob, 2006/4/18, Rob Balfour <rob_uk88@hotmail.com>:> <%= 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 ! -- Fran?ois Beausoleil http://blog.teksol.info/
Fran?ois Beausoleil wrote:> Hello Rob, > > 2006/4/18, Rob Balfour <rob_uk88@hotmail.com>: >> <%= 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. -- Posted via http://www.ruby-forum.com/.
Rob Balfour 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
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