Run Multiple Rails Servers at the Same Time

It's annoying to shut down and start up your Rails server when jumping between projects. Learn how to run multiple servers at the same time.

If you jump between multiple Rails projects frequently, you probably get annoyed shutting down servers and starting them up again, and shutting them down, and starting them up again.

You start your Rails server like so (as I'm sure you know):

$ bundle exec rails s

That makes your application available at http://localhost:3000.

Additionally, you can run another Rails server from another project on a different port by passing it the -p argument. Let's say we want to start the server on port 3001.

$ bundle exec rails s -p 3001

Now this application is available at http://localhost:3001.

Alternatively, check out Pow. I love the concept of it, but I ran into too many issues and just went back to the old-school, command line approach.

Let's Connect

Keep Reading

Transition Between Database Adapters in Rails

Transitioning from one database to another, or even to a whole new database with a new adapter, can be tough. Here's an easy way to transition content.

May 25, 2015

Order Rails Query by Virtual Attribute

Rails' scopes don't work well with virtual attributes since they resolve to a SQL query. Instead you can throw them in an array and then sort by a virtual attribute.

Oct 22, 2014

Why I Don't Use has_and_belongs_to_many in Rails

The magic of Rails makes it easy to create simple many-to-many relationships, but I almost never use it, and here's why.

Mar 31, 2015