简体   繁体   中英

Error when defining field types on Ruby on Rails

I'm getting an error on RoR that I can't seem to fix yet, it is the following:

I have my form setup like this

<%= form_for @sheet, url: '/sheets#new' do |f| %>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                      Inicio:<br>
                      <%= f.datetime_field_tag :Inicio %>
                      Fim: <br>
                      <%= f.datetime_field_tag :Fim %><br>
                      Tarefa:<br>
                      <%= f.number_field_tag :Tarefa %><br>  
                      PNA:<br>
                      <%= f.number_field_tag :PNA %><br>
                    </div>
                </div>

                <div class="col-sm-6">
                    <div class="form-group">

                      FPNA:<br>
                      <%= f.number_field_tag :FPNA %><br>
                      Deslocação:<br>
                      <%= f.number_field_tag :Deslocacao %><br>
                      KM's:<br>
                      <%= f.number_field_tag :km %><br>
                      Estadia:<br>
                      <%= f.number_field_tag :estadia %><br>
                    </div>
                </div>
            </div>
                    <div class="text">
                      Descrição:<br>
                        <div class="textfield">
                            <%= f.text_field_tag :descricao %><br>
                        </div>
                    </div>



                    <%= submit_tag "Submit" %>
        <% end %>

and when I try to submit anything I get the following error:

undefined method `datetime_field_tag' for #<ActionView::Helpers::FormBuilder:0xd13f898>

If for example I take out the f. on the fiels it works but it posts every field as "null" on the database, help/ideas on how to fix this?

使用datetime_field用的form_for而不是datetime_field_tag

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM