Forum: Ruby on Rails Fetching values from Table - Need help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C9b09268e3cfcf33311cf0c85ba30ada?d=identicon&s=25 Shankar Ganesh (lookshankar)
on 2009-02-04 12:14
Hi ,

    I have table like this
     ---------------------------------------------------------------
    |id | what   | when      | color  |   to      | description     |
    ---------------------------------------------------------------
    |1  | test   |2009-02-01 | red    |2009-02-15 |    yyyyy        |
    ---------------------------------------------------------------
    |2  | test2  |2009-02-02 | green  |2009-02-14 |    xxxxx        |
    -----------------------------------------------------------------

i want output like this,

2009-02-01=><Div id='1'style='color:red'>yyyyy</Div>
2009-02-02=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-03=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-04=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-05=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-06=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-07=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-08=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-09=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-10=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-11=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-12=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-13=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-14=><Div id='1'style='color:red'>yyyyy</Div><Div
id='2'style='color:green'>xxxxx</Div>
2009-02-15=><Div id='1'style='color:red'>yyyyy</Div>

Note:
-----
The 'id' of div is the value of 'id' field in database
The 'color' of div is the value of 'color' field in database
The 'description' of div is the value of 'description' field in database


can any one help in this for me......
Thanks in advance,
shankar.
This topic is locked and can not be replied to.