如何使用Rails best_in_place使文本框更宽?

Son*_*ack 4 ruby-on-rails ruby-on-rails-4

我尝试过以下操作:

<%= current_user.first_name %>
<%= current_user.last_name %>
<span class="bubble">
  <%= best_in_place current_user,
        :blurb,
        type: :textarea,
        :cols => "30",
        :rows => "50",
        :inner_class => 'occupation-edit',
        nil: 'Add a short blurb (max 140)'
  %>
</span>
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用.是否可以使文本区域更长,如垂直长度?看起来它不能用'best_in_place'宝石定制.

sum*_*mea 6

通过使用html_attrs,您可以设置这些类型的参数,如下所示:

<%= best_in_place current_user,
      :blurb,
      :type => :textarea,
      :html_attrs => { :cols => '30', :rows => '50' }
%>
Run Code Online (Sandbox Code Playgroud)

如果rowscols属性不起作用,您可能想要尝试该style属性,如下所示:

<%= best_in_place current_user,
      :blurb,
      :type => :textarea,
      :html_attrs => { :style => 'width:500px; height:500px;' }
%>
Run Code Online (Sandbox Code Playgroud)