Getting started with Rails beyond your 15 minute blog.

Leonard Garvey
May 7, 2013

After doing a tutorial like the InstallFest “not-so 15 minute blog” series you may be left wondering how to go ahead and create your own application. After all you probably didn’t want to make a blogging application, but instead you’ve got your own wonderful idea and you’re still a little unsure about how learning to make a blog gets you any closer to creating your own application.

Start Small

The most important thing to remember is that almost every application can start out small and be built up. The challenge is to narrow down the scope of your idea to the absolute bare-minimum. In the blog application we first started off by creating a Post “resource” and then built up extra functionality from that point.

Thinking in Resources

The best way to think about your application is to think about a single block of data that you’d like to perform operations on. This block of data is a resource. Rails makes it easy to perform generic actions on each resource Creating, Reading, Updating and Deleting (CRUD). This is exactly what we did when we scaffolded the Post resource. We created a small piece of data and allowed the users to interact with it.

The first challenge of starting small is to figure out what your application’s main resource is. In the blog it was the Post model, but in a Timesheet application it might be the either a TimeEntry or a Timesheet resource. Some applications (like a Timesheet app) have two resources which form the core of the application. This mirrors the core of the functionality in the blogging application where we had Posts and Comments. One of those models will naturally attract more logic and become the “main” resource.

Basic Beginnings

Once you start building your application try to forget about design and front-end interaction. For a first prototype stick with simple HTML and HTTP focusing on building clean resourceful routes. Once you’ve got something minimally useful it’s entirely possible to write some JavaScript adding a dash of jQuery and Backbone to make it more user-friendly and then to add some CSS to make it pretty. It’s too easy to get bogged down by how it looks before you’ve even got the most basic functionality working.

The benefits of building your app like this are many, but mostly it allows you to refine the functionality of your application without becoming attached to a particular design or interaction.

Top 10 tips for Starting Rails

  1. Keep your idea small and simple.
  2. Implement the most basic thing that could possibly work. That means ignoring design and fancy interactions.
  3. Spend some time learning Ruby too. Rails will seem much less “magic”.
  4. Attend community events like RoRO Sydney.
  5. Read the Rails Guides, particularly the Getting Started guide, Migrations, Action Controller and the Layout and Rendering guide.
  6. Learn to read the documentation. On OS X there’s a popular offline documentation browser called Dash which is strongly recommended.
  7. Try to keep your methods small and focused. Methods should be less than 10 lines long!
  8. Write simple, semantic HTML. This will be easier to work with when you come to do CSS and JavaScript.
  9. Don’t be afraid to ask for help. Stackoverflow and IRC are both excellent places where you can get help for free.
  10. Use git and github to store your code. Even consider making your first application open source so that people can easily help you out.
  11. Attend InstallFest and Development Hub (optional but recommended).