ruby on rails - Unexpected array output on page -
i'm listing set of data (for simplicity sake, identity column) of particular database table table follows:
<%= @fields.select{|field| field.model=="preferredoffering"}.each |field| %> <%= field.id %> <br/> <% end %>
as may have gathered above, i'm using combination of select
, each
iterate through rows column model
contains string preferredoffering
.
my expectation see nice ordered list of numbers , indeed do. confusion see entire @fields
array coughed on page, below list of numbers. (see below html excerpt)
106 <br/> 107 <br/> 108 <br/> 109 <br/> 110 <br/> 111 <br/> 112 <br/> [#<preferredofferingfield id: 5, field_heading: "anti-dilution provisions- typical weighted average", category: "anti-dilution", intra_cat_order: 1, model: "p
my guess i'm doing funny select
i'm not familiar usage.
any ideas on how remedy received gratefully; in advance.
<% %>
executes ruby code inside
<%= %>
prints results
you displaying array , it's values, want change <%= %>
<% %>
.
<%= @fields.select{|field| field.model=="preferredoffering"}.each |field| %>
to
<% @fields.select{|field| field.model=="preferredoffering"}.each |field| %>
Comments
Post a Comment