Databases & Rails: Week 3 Pure Ruby Views26 Jun 2012
In week one we learned about storing data and using databases. In week 2 we saw how we can model relationships with databases, and use those relationships with Ruby and Active Record to build models in Rails. This week we start out with a quick Recap of last week followed by a Quiz. Once you finish the quiz you can check out the Quiz Solutions.
This week we will be focused on building cool things with Pure Ruby (no Rails). We’re going to cover some Ruby basics, and then dive into an exercise where we build an HTML generator using only Ruby. The students really enjoyed the exercise, and got quite a bit out of it, so you shouldn’t skip it. Even if you’ve been using rails for years, the exercise might give you new insight into how exactly some of that Rails magic works.
We’ll also cover using GIT and you’ll need that for the exercise. Get ready cause here comes some serious learning.
Week 3 Videos
Introduction of topics covered:
Ruby arrays and iterating over them with each and map methods:
Using the functions found in Ruby’s STDlib:
Using the ERB library from Ruby’s STDlib to generate HTML:
Finally an Introduction to using GIT. We cover the basics of using a source control management software (GIT) as well as the mechanics of saving files, adding them to a repo, and committing them. GIT is a valuable skill to have, and is needed for the exercise.
Week 3 Exercise
If you’re thinking about skipping the exercise, don’t. Programming is a language that you have to learn by using it. As always if you get stuck try googling, or posting onto StackOverflow.
The only difference is that I won’t be grading your work, so don’t submit a pull request when you’re done.
Good luck and happy coding.
Next week we’ll be putting what we learned about databased backed models and view generation together to start building a fully functional app. Stay tuned, subscribe to this tumblr blog, or youtube channel and let me know if you’ve got any comments @schneems