ruby on rails - accessing a specific field in a table in view -


i have in view

<div class="container">   <div class="col-xs-6 col-md-6">   <% @existingusers.each |existinguser| %>     <ul>       <li><%= existinguser.email %></li>       <li><%= existinguser.trial_subscriptions %></li>     </ul>   <% end %>   </div> </div>  <li><%= existinguser.trial_subscriptions %></li> 

is returning fake data in rails

[#<trialsubscription id: 15, user_id: 58, created_at: "2014-03-25 01:29:57", updated_at: "2014-03-25 01:29:57", question_bank_id: 1, customer_id: nil, card_type: nil, card_last4: nil, manual_expiry_date: "2014-04-08 01:29:57", type: "trialsubscription", last_active_check_date: nil, cached_active_value: nil, cached_coupon_string: nil, cached_period_end: nil, cached_cancelled_at_period_end: nil>] 

i want draw out manual_expiry_date column.

i have tried this

<li><%= existinguser.trial_subscriptions[:manual_expiry_date] %></li> 

i getting no implicit conversion of symbol integer

and manual_expiry_date datetime field ?

i have tried

<li><%= existinguser.trial_subscriptions[:manual_expiry_date].to_i %></li> 

adding to_i

the record returning array , should way it?

try:

<%= existinguser.trial_subscriptions.collect {|trial_subscription| trial_subscription.manual_expiry_date } %> 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -