html - Setting Table Headers and populating Data; Rails and SLIM -


i very, new rails , slim.

i trying create summary table using

h2 trading history table.table-striped.table-bordered#analysis  thead   tbody  - @stock_summary[:stocks].each |key2, value|    - value.each |key2, value2|      tr       th = key2       td = value2 

unfortunately, output forcing data 2 columns so:

name                          lennar corporatio revenue                       -7320.0 tax_liability                     -0.55 capital_at_risk                0.0 returns                       -1.28 average_holding_period         2.0 capital_invested_percentage        0.0 name                           general electric revenue                        2688.89 tax_liability                  0.17 capital_at_risk                0.0 returns                        2.05 average_holding_period         2.7777777777777777 capital_invested_percentage        0.0 

i summary table use info (name, revenue, tax_liability, capital_at_risk, returns, average_holding_period, capital_invested_percentage) 7 column headers.

then populate table info listed right.

as per jason's comment: @stock_summary[:stocks].inspect yields:

{"len"=>{:name=>"lennar corporatio", :revenue=>-7320.0, :tax_liability=>-0.55, :capital_at_risk=>0.0, :returns=>-1.28, :average_holding_period=>2.0,  :capital_invested_percentage=>0.0}, "ge"=>{:name=>"general electric", :revenue=>2688.89, :tax_liability=>0.17, :capital_at_risk=>0.0, :returns=>2.05,  :average_holding_period=>2.7777777777777777, :capital_invested_percentage=>0.0}, 

any appreciated!

-frank

how work?

table   thead     tr       th name       th revenue       th etc.   tbody     - @stock_summary[:stocks].each |stock, stock_details|       tr          - stock_details.each |attribute, value|           td = value 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -