Question

I have this little bit of code info in the controller:

@today_date = Time.current.to_date.strftime('%Y%m%d')
      client = TinyTds::Client.new(:username => 'tr', :password => 'tr', :host => 'xxx.xxx.xxx.xxx', :database => 'KTrade')
      data = client.execute("Select symbol, side, orderID, quantity, broker, trader from BBOrders WHERE creationDateTimeInt =" + @today_date)
      a =[]
      data.each do |row|
          a << row
      end
      @ret = a

And this chunk inside the view:

<% @ret.each do |row| %>
<div>
       <%= row %>
</div>
     <% end %>

And I get this sort of output:

{"symbol"=>"Symbol1", "side"=>"BUY ", "orderID"=>"222222", "quantity"=>15, "broker"=>"bankz", "trader"=>"someUser"} 

And it outputs the whole row. How can I retrieve those values individually?

Was it helpful?

Solution

You just put @ret["symbol"] etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top