Using ruby object in views -


I am trying to display this object in my view

  - - - ruby ​​/ object: Customer Attributes: Country: United Kingdom last_name: a first_name: b attributes_cache: {} History: - ruby ​​/ object: history attributes: start_date: 11/03/2010 finish_date: attributes_cache: {}  

I thought that you can reach start_date by creating a

  & lt;% @ customer. & Gt%; & Lt;% = customer.histories.start_date% & gt; & Lt;% end% & gt;  

But me

  undefined method `start_date ' 

this is the search I used

  @customers = Customer.find (: All ,: conditions => ['customers.id IN (?)', Intersection] ,: included =>: history)  

What am I doing wrong?

thanks

customer's personalities one of the items Array, so you want something like this:

  & lt;% @ customers.each do | Customer; & Gt%; & Lt;% = customer.histories.first.start_date% & gt; & Lt;% end% & gt;  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -