I'd like to change the size of text_field, but it doesn't work.
new.html.erb
<div class="row">
<%= form_for(@user) do |f| %>
<%= render 'fields', f: f %>
<%= f.submit "Create my account", class: "btn btn-large btn-primary" %>
<% end %>
</div>
_fields.html.erb
<%= f.label :name %>
<%= f.text_field :name, size: 10 %>
size: 10
doesn't work.
This is worked example, you doing some wrong, i belive you have some css style that override you text field :
<%= f.text_field :user, size: 10 %>
If i delete class
from submit, place </br>
, set 0 width
in css, and now i see size
of the text_field
I hope you understand this.
试试这个size
选项
<%= f.text_field :name, :size=>"10" :maxlength=>"254" %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.