Story Details

Replacing Rails: Part 1 "Lets Go!" – Made by Many

Posted By tutorialStash on Golang - Rails has been, whether I like it or not, a pretty big chunk of my life. When I first started charging for my work, Rails was new and it seemed like a community of really active developers. Github and RubyGems seem to have changed the way we all write and use code. (Remember when Github used to be the best RubyGem host?!)Here at Made by Many, Ruby along with Rails is often our back end of choice for building applications that require a quick turnaround, particularly when there is lots of CRUD involved. It's often an easy option with a fairly good toolset (we’ll talk more about that later) and lots of RubyGems around it cover everything from pagination to authentication.Simply “not using Rails” anymore however is, well, not that simple! Rails does certain things very well and that’s a part of why it’s still around. In particular, Forms, Database mapping (ORM), Convention, Emails, Rake Tasks and Migrations to name a few, so what’s around that has a chance of replacing Rails? Go!I’m not going to try and teach you Go from scratch, but look at the getting start guide and Go by Example for some great help there. Also this video is a great talk about some ideas behind the concurrency in Go.I’m hoping to make this into a series of posts, but I’m not going to make a step by step guide. If that’s something that could interest you, perhaps a screencast is in order.In the last week I’ve been building an app that includes Dropbox authentication, a job queue and RESTful controllers — so let’s have a look at some of those parts extracted and compare them to Rails-land! In this example I’m using a simple router/toolkit called Martini.Here’s my model for Reels (a Reel is a collection of Photos); not so different really! The JSON notation you see is called ‘tags’ in Go, it’s essentially metadata added to the field and here it specifies the field names Go will use to parse or encode JSON. “-” means don’t print anything and “omitempty” means only output the field if it isn’t null.

Submit a Comment

Log in to comment or register here