DAES
DAES

Reputation: 57

Tranformar HTML in Rails 4

I require converted into HTML code:

<div class="form-group">
       <label class="font-noraml">Pais</label>
            <div class="input-group">
              <select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
                <option value="">Select</option>
                <option value="United States">United States</option>
                <option value="United Kingdom">United Kingdom</option>

               </select>
           </div>
    </div>

IN

<div class='form-group'>
    <label >Pais(*):</label>
    <%= f.select :country_id, @countries.collect{|t| [t.name,t.id]}, :id=>"country_id", :class=>"form-control required", :name=>"perfil_id", :type=>"text" %>
</div>

But I have mistake, I do not show me the styles of HTML code.

Upvotes: 0

Views: 40

Answers (2)

Richard Peck
Richard Peck

Reputation: 76774

<% content_tag :div, class: "form-group" do %>
   <%= f.collection_select :country_id, @countries, :id, :name, {id: "country_id", class: "form-control required", prompt: "Pais"}, {name: "perfil_id"} %>
<% end %>

Upvotes: 1

vipin
vipin

Reputation: 2510

try this:

 <div class="form-group">
  <%= f.label :country %><br>

  <%= f.collection_select :country_id, Country.order(:name),:id,:name, include_blank: true %>
 </div>

Upvotes: 1

Related Questions