Updating a tiny Rails app from Rails 3.1 to Rails 4.2

              · ·

In 2011 I wrote a small Rails app in order to learn Ruby better and see what all the fuss was about – this was Antipodes, a website that shows you the antipodes of a given point or country/state using google maps. I built it using the latest and greatest version of Rails available at the time, which was 3.2. It has since fell to various security issues and has been superseded by newest version, and is currently unsupported.


Rails in a week - day 7

              ·

Today was the last day of my Rails week. I added some database-backing to my app (with a fully scaffolded model and all!) for the countries’ data and refactored a fair bit, though I’m still unsure about a few decisions I made, such as if I should put the base data in seeds.rb or in a migration. Oh, well. The website is available here: http://antipodes.plui.es And its source code is on GitHub.


Rails in a week - day 6

              ·

TL;DR: testing works, I learned i18n, and fixed a bug through TDD. After writing a simple little functional test and making it run through rake test, albeit slowly, I installed Spork and autotest. From what I gathered, Spork is an RSpec-only thing, so I wrote a few RSpec tests instead of functional tests. After a bit of tweaking, everything was going smoothly between Spork and autotest, all running RSpec, but my file in test/ was ignored.


Rails in a week - day 5

              ·

TL;DR: polishing. Trying to get into TDD, but slowness makes it a strange experience. This “day 5” has been more or less spread over two days because of other engagements (mowing the lawn and subscribing an insurance policy for abroad if you wish to know the details), and I didn’t keep precise tracks of the steps I took. The major milestone is that the MVP for Antipodes is online at http://antipodes.


Rails in a week - day 4

              ·

TL;DR: it deploys! Finally! After a full day spend battling cryptic error messages, I finally got my 10-lines Rails app to deploy. First thing in the morning, I decided to switch to using rvm on my production machine too, in order to have the same setup and version on Ruby (1.9.2) for testing and production. This meant also reinstalling the important gems (bundler, rails, rake). The production machine uses nginx+Passenger, which I reinstalled (following instructions here) in order to work smoothly with this now rvm-ed ruby.


Rails in a week - day 3

              ·

TL;DR: phew. Deployment is hard. Testing is slow. Morning: off due to World Cup; watching of the match against New Zealand. :( Afternoon: while playing a bit more with the prototype, I noticed the logic is actually broken and my way to calculate an antipode was actually broken. This came from the fact that the longitude and latitude coordinates aren’t logically the same. Latitude divides the globe on its equator while longitude is arbitrarily positioned… I guess?


Rails in a week - day 2

              ·

TL;DR: I have a terribly ugly first draft of the application working! Morning: spent finishing reading the Getting Started guide and beginning the Rails Tutorial. Afternoon: so, let’s get down to maps… What’s cool in Rails is that there are plenty of gems, and you just have to plug them in, right? GoogleMapsForRails seems like the right tool for the job. After trying to get my posts to be geolocalized… Success!


Rails in a week - day 1

              ·

TL;DR: I began learning Rails this morning, and even though Rails in itself is (seems?) easy enough, setting everything up and deploying is hairier. 8:00: let’s get started! First step: getting vagrant up and running. We’ll hit the tutorial. 8:15: the lucid32 “box”, Vagrant’s parlance for a virtual machine image, is downloading. Time to get a cup of coffee. 8:40: box downloaded, let’s get on with the VM setup process. vagrant ssh… Yep, it works!


Rails in a week - day 0

              ·

Tl;dr: I’m learning Rails in a week! And I’ll blog about it all along. Any tips? So. Learning Rails. As a recent graduate in CS, moving to a new country in two weeks and looking forward to expand my skills, Rails looks like a good fit: it’s in demand, it focuses on developer happiness, vibrant ecosystem yadda yadda. You probably already know this so let’s cut the marketing speak!