jeudi 13 août 2015

Ruby form_for html attributes not working, multipart or id

I am desperately trying to put a multipart to my form in Ruby but it won't show up. I looked up online everywhere but whatever I try it doesn't show. Even simple IDs or classes won't work...

Is there any dependency I am not aware of?

<%= form_for @listing, :html => {:id => "account_form", :multipart => true } do |f| %>
  <%= render 'shared/error_messages', object: f.object %>
  <%= f.label :title %>
      <%= f.text_field :title, class: 'form-control' %>

      <%= f.label :highlights %>
      <%= f.text_area :highlights, class: 'form-control' %>

      <%= f.label :location %>
      <%= f.text_area :location, class: 'form-control' %>

      <%= f.label :catering %>
      <%= f.text_area :catering, class: 'form-control' %>

      <%= f.label :travel %>
      <%= f.text_area :travel, class: 'form-control' %>

      <%= f.label :dates %>
      <%= f.text_area :dates, class: 'form-control' %>

      <%= f.label :price %>
      <%= f.text_field :price, class: 'form-control' %>

      <%= f.label :category %>
      <%= f.select :category, options_from_collection_for_select(Category.all, :id, :name), :include_blank => true %>

      <%= f.label :country %>
      <%= f.text_field :country, class: 'form-control' %>

      <%= f.label :url %>
      <%= f.text_field :url, class: 'form-control' %>

      <%= f.label :photo %>
      <%= f.file_field :photo %>

  <%= f.submit "Post", class: "btn btn-primary" %>
<% end %>

which will result in the following HTML

<form class="new_listing" id="new_listing" action="/listings" accept-charset="UTF-8" method="post">

Please help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire