Answer the question
In order to leave comments, you need to log in
How to add CSS style to Ruby code?
Hello, I'm new to RoR, writing a small project for myself. When I finished writing the functional, the question arose - how to style it all. I chose Bootstrap. Now the question is let's say there is a form <%= f.text_area :body %>
How to apply form style from Bootstrap to this code?<textarea rows=""></textarea>
Answer the question
In order to leave comments, you need to log in
I would advise you to use the gem https://github.com/plataformatec/simple_form
1. Add the gem.
2. rails generate simple_form:install --bootstrap
3.
<%= simple_form_for @зщые do |f| %>
<%= f.input :body, as: :text %>
<% end %>
<%= form_for (@post), html: { class: 'form-horizontal' } do |f| %>
<div class="form-group">
<%= f.label :body, "Контент" %>
<%= f.text_field :body, class: 'form-control' %>
</div>
<% end %>
You can also see the bootstrap_form gem https://github.com/bootstrap-ruby/rails-bootstrap-forms
<%= bootstrap_form_for(@user) do |f| %>
<%= f.email_field :email %>
<%= f.password_field :password %>
<%= f.check_box :remember_me %>
<%= f.submit %>
<% end %>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question