Articles Tags Authors Most Popular

Day 4 - Popular Articles + Heroku Deployment!

Tags: ruby rails day4 popular articles heroku



Today I worked on getting the page views to all show up correctly and then eventually make a Popular page view. Well, let me tell you, this was one tough cookie. I had no idea where to start. Do I create a new view, controller, model, html? No idea. Posted on our slack channel after racking my brain for quite some time. Kevin let me know to create a controller. This is a good start. I thought maybe I could get away with not creating a controller, because I wanted to be lazy and efficient. So I ended up creating a popular controller.I then made an index.html.erb in the Popular views folder. This contained the layout which I was going to have on that page. Now the fun really began... How the heck do I get to the page views, sort them accordingly, and then have the article titles print. But, not only the article titles, but also links to them. Long story short, I played with a Hash, put all of the articles and article.impression.size pairs in there. Ran a sort for that Hash and stored it in another array. Doesn't that sound crazy already? Well, then I played around trying to extract just the title and impression.size from the array in a For loop for the first 3 articles. Phew! Well, I finally did get it going. And finally, I also deployed to Heroku!!



Comments (5)

Comment by Cordelia

Posted 9 months later

Catarino,Vim desejar a vc e a toda sua família um belíssimo Natal com muita harmonia e fartura e que 2009 seja repleto de coisas boas, muito amor, fraternidade, saúde, grandes realizações e $udor$o.Ace$ei sua companhia este ano e espero tê-la por outros mais.Beijocas doces no coração.

Comment by Xannon

Posted 9 months later

Wow, your post makes mine look <a href="http://zwdvccrptc.com">feblee.</a> More power to you!

Comment by Adelaide

Posted 9 months later

Taking the ovwveier, this post is first class http://vfmpdd.com [url=http://hhzqdkaxhfg.com]hhzqdkaxhfg[/url] [link=http://evvxubww.com]evvxubww[/link]

Comment by Lakeisha

Posted 9 months later

I don't even know what to say, this made things so much <a href="http://qzegqei.com">earsei!</a>

Comment by Janessa

Posted 9 months later

Grazi for mankig it nice and EZ. http://qkckgq.com [url=http://zmqvvc.com]zmqvvc[/url] [link=http://towjjoplvq.com]towjjoplvq[/link]

Post a comment



<< Back to Articles List
(login)