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/> [#&lt;preferredofferingfield id: 5, field_heading: &quot;anti-dilution provisions- typical weighted average&quot;, category: &quot;anti-dilution&quot;, intra_cat_order: 1, model: &quot;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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -