Day13 — Rails

Total time spent: ~1hr

--

Been falling off the wagon. Partially because of EuroTrip, but that can’t be an excuse. It may be too “simple” now, so increasing the complexity & interestingness.

I need to feel like I’m making progress. So tonight, I stayed in and started doing the Blogger Rails app with http://tutorials.jumpstartlab.com/projects/blogger.html

Also for building my habit: using the simple mechanism of “chaining” — http://chaincalendar.com/ Simply “don’t break the chain,” said Seinfield. Inspired by this article from Buffer:http://blog.bufferapp.com/stop-procrastinating-seinfeld-strategy

Learnings:

  • I’m learning that defining the model first helps me structure/organize my code
  • Next is to define the corresponding methods in the controller
  • And finally, rendering it in views
  • I tried learning Rails before and got this confused — and it was no different this time: there is a difference between <% and <%= in Rails (templating language, mixing ruby & html)

<% will HIDE the Ruby output

<%= will SHOW the Ruby output

For example: <%= Article.each do |article| %> and showing the Article.title, would’ve showed the SQL output as well.

<% Article.each do |article %> would’ve hidden the SQL output.

I’m excited to finally put the pieces together with Ruby & Rails. My brain was craving it. Also, I look forward to pushing out 1 simple web app / day in the future. These simple web apps would just be simple solutions to mundane problems that I bump into.

Inspiration? Magritte, the painter, Eminem, the rapper, Kanye the producer (when he was pushing out 3 tracks per day over the summer), etc.

--

--

David Ngo
Learning to Code in RoR: Journey with non-techies

My Life Purpose: Advance Humanity by Helping Motivated People Develop a Daily Practice of Meditation.