2
I am creating a system of appointments with clients, projects, activities, professionals and appointments, all parts pass and save correctly, except the part of the launch of the notes.
Follow the error image when trying to make the note.
Follow the code of the new.html.erb
<%= form_for (@timesheet), html:{ class: "form-horizontal" } do |f| %>
<!-- Alert Error -->
<%= error_messages_for @timesheet %>
<!-- Title -->
<div class="form-group">
<%= f.label :activity_id, "Atividade:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= collection_select(:timesheet, :activity_id, Activity.all, :object_id, :name) %>
</div>
</div>
<div class="form-group">
<%= f.label :professional, "Profissional:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= collection_select(:timesheet, :professional, Professional.all, :user_id, :name) %>
</div>
</div>
<div class="form-group">
<%= f.label :day, "Dia:", class: "control-label col-sm-2" %>
<div class="col-md-2 col-sm-9">
<%= f.text_field :initial_hour, :class => 'form-control date', placeholder: 'DD/MM/AAAA' %>
</div>
</div>
<div class="form-group">
<%= f.label :initial_hour, "Data/Hora Inicial:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.time_select :initial_hour, :class => 'form-control', :required => true %>
</div>
</div>
<div class="form-group">
<%= f.label :final_hour, "Data/Hora Final:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.time_select :final_hour, :class => 'form-control', :required => true %>
</div>
</div>
<div class="form-group">
<%= f.label :quantity_hours, "Quantidade de horas:", class: "control-label col-sm-2" %>
<div class="col-md-2 col-sm-9">
<%= f.text_field :quantity_hours, :class => 'form-control', :required => true %>
</div>
</div>
<div class="form-group">
<%= f.label :situation, "Situação:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.select :status, Timesheet.status.options %>
</div>
</div>
<div class="form-group">
<%= f.label :remunerated, "Remunerado:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.check_box :remunerated, :class => 'form-control', :required => true %>
</div>
</div>
<div class="form-group">
<%= f.label :billed, "Faturado:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.check_box :billed, :class => 'form-control', :required => true %>
</div>
</div>
<div class="form-group">
<%= f.label :displacement, "Deslocamento:", class: "control-label col-sm-2" %>
<div class="col-md-6 col-sm-9">
<%= f.check_box :displacement, :class => 'form-control', :required => true %>
</div>
</div>
<div class="hr-line-dashed"></div>
<!-- Buttons -->
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<%= link_to "Cancelar", timesheets_path, :class => 'btn btn-white' %>
<%= f.submit "Salvar", :class => 'btn btn-primary' %>
</div>
</div>
<% end %>
PS: I’m new to Rails and I’m a little lost. PS²: I am using enumerize to set the options in the status.