Table of contents



Rails, or Ruby on Rails, is a server side web app framework written in Ruby. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. Like Ruby, Rails is designed with ‘programmer happiness’ in mind and prioritises readability, ease and enjoyment of use.

Rails is an MVC (Model-view-controller) framework and famously favours Convention over configuration in an attempt to aid productivity and lower the barrier to entry. An example of this is the way in which a model in Rails maps to a table in a database and to a Ruby file, it is only if one deviates from this convention, that the developer needs to write code regarding these names.

Ruby on Rails is separated into various packages including: - ActiveRecord - Active Resource - Action Pack - Active Support - Action Mailer

Rails is sometimes criticised for issues with scalability due to being written in the relatively slow performing Ruby. It should be noted, however, that many high profile, high traffic web apps are currently running on Ruby on Rails including Airbnb, Github and GOV.UK!

Starting out

Which version?

When working with an existing rails project, the rails version will be specified in the gemfile and all you will need to do is navigate to the application in your terminal and run bundle install and voila, all dependencies will be installed.

If you are starting a project afresh then rails offers wonderful documentation to help you begin

Working with Rails Projects

As noted above, the dependencies are listed in a 'Gemfile’.

A Rails application can be run with bundle exec rails --server. It is common practice to define how to get started with a Rails application through a README file in the root of the project.

Tasks in a Rails project will typically be run using [Rake][rake] which, by convention, will usually run the tests of an application if it is not provided any arguments.

Rails Test Frameworks

See Ruby test frameworks

Code style

You can find the GDS programming language style guides here

Additional Tools

  • Pry-byebug A step by step debugging tool
  • Factory bot A library for setting up Ruby objects as test data
  • GOVUK-lint A linter which complies with GOV.UK ruby styleguide.
  • GOVUK_app_config A library which includes the basics of a GOV.UK application including error reporting, a Unicorn web server, logging and a stasd client.
  • GDS-api-adapters A set of API adapters to make working with GDS APIs easier.

Reference documentation

Learning materials

  • Michael Hartl’s RoR Tutorial Arguably the most famous beginners guide to Rails available.
  • Railscasts Ryan Bates’ YouTube channel which contains webcasts on just about everything Rails, an excellent resource for the visual learner, although some of the videos are a little dated.
  • Thoughtbot blog Thoughtbot, the people behind factory bot and many other high profile ruby gems, have a great, regularly updated blog often covering rails or ruby specific issues as well as general thoughts on software development.
This page was last reviewed on 16 November 2018. It needs to be reviewed again on 16 November 2019 .
This page was set to be reviewed before 16 November 2019. This might mean the content is out of date.