I have an array of objects returned from Rest in JSON format, when I debug I just see the reference. I have added the do loop to one of my views, but I don't have any properties of the object. Is there something I need to do like cast the array? I'm new to ruby and have searched and found nothing specific to this.
First controller not PolicyList
data3 = data2.map { |rd| PolicyList.new(rd["policyNbr"], rd["systemId"], rd["insuredName"], rd["type"], rd["statusCd"], rd["statusDes"], rd["payorZipcode"], rd["lastPaymentDate"], rd['lastPaymentAmount'], rd["pastDueDate"], rd["pastDueAmount"], rd["currentDueDate"], rd["currentDueAmount"], rd["eft"], rd["suspenseAmt"], rd["expireTime"]) }
$policylist =data3
puts data3.inspect
WebView.navigate(url_for(:controller => :PolicyList, :action => :index))
PolicyList Controller
def index
#@policylists = PolicyList.find(:all)
@policylists = $policylist
render :back => '/app'
end
PolicyList index.erb
<ul data-role="listview">
<% @policylists.each do |policylist| %>
<li>
<a href="<%= url_for :action => :show, :id => policylist.policyNbr %>">
<%= policylist.policyNbr %>
</a>
</li>
<% end %>
</ul>
PolicyList class
# The model has already been created by the framework, and extends Rhom::RhomObject
# You can add more methods here
class PolicyList
include Rhom::PropertyBag
attr_accessor :policyNbr, :systemId, :insuredName,
:type, :statusCd, :statusDes, :payorZipcode,
:lastPaymentDate,:lastPaymentAmount,:pastDueDate,
:pastDueAmount,:currentDueDate,:currentDueAmount,:eft,
:suspenseAmt,:expireTime