Note that there are some explanatory texts on larger screens.

plurals
  1. POObject with empty attributes in collection
    primarykey
    data
    text
    <p>I have collection of objects fetched from database and when I itterate over it with .each method I get single object with only empty values, like this:</p> <pre><code> - !ruby/object:List attributes: id: 4 title: Test project_id: 10 created_at: 2013-12-29 20:53:04.087839000 Z updated_at: 2013-12-29 20:53:04.087839000 Z - !ruby/object:List attributes: id: 5 title: Testng project_id: 10 created_at: 2013-12-29 20:53:59.087687000 Z updated_at: 2013-12-29 20:53:59.087687000 Z - !ruby/object:List attributes: id: title: project_id: 10 created_at: updated_at: </code></pre> <p>What is ok, but... in my SQLite3 database I have only two rows... As doing work around here is not any problem for me I would like to understand why it happens. Could you explain me please?</p> <p>Here is my controller and partial view in which I am using @current_lists variable</p> <p><strong>projects_controller.rb</strong></p> <pre><code> def show @project = Project.find(params[:id]) @attachment = Attachment.new @list = @project.lists.new @current_lists = @project.lists @current_attachments = @project.attachments @current_issues = @project.issues.includes(:category) respond_to do |format| format.html # show.html.erb format.json { render json: @project } end end </code></pre> <p><strong>_lists.html.haml</strong></p> <pre><code>- @current_lists.each do |project| .col-md-4 .panel.panel-default .panel-heading =project.title .pull-right.text-success %a.fa.fa-plus.fa-lg %ul.list-group.task-list %li.list-group-item.selected %label.label-checkbox.inline %input.task-finish{checked: "checked", type: "checkbox"}/ %span.custom-checkbox SEO Optimisation %span.pull-right %a.task-del{href: "#"} %i.fa.fa-trash-o.fa-lg.text-danger / /list-group </code></pre> <p>EDIT: That is modal code that I use to render form which uses @list instance variable:</p> <pre><code>/ /Modal #newList.modal.fade .modal-dialog .modal-content .modal-header %button.close{"aria-hidden" =&gt; "true", "data-dismiss" =&gt; "modal", type: "button"} &amp;times; %h4 Modal with form .modal-body =form_for [@project, @list] do |f| - if @list.errors.any? #error_explanation %h2= "#{pluralize(@list.errors.count, "error")} prohibited this list from being saved:" %ul - @list.errors.full_messages.each do |msg| %li= msg .form-group = f.label :title = f.text_field :title, class: 'form-control input-sm' .form-group = f.submit 'Save', class: '.btn.btn-success' / /.modal-content / /.modal-dialog / /.modal </code></pre> <p>Thank you in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload