Posts tagged with “rails”

Pry is an interactive console, like IRB, which can be used to pause execution and inspect the current scope in your Rails web requests or tests. I'm going to show you how simple it is to drop it into your Rails apps and get better visibility over bugs.

Read the rest

I've been involved in writing a rake task to migrate an old database schema to a similar but new schema in a Rails project. The new schema was similar enough that we could carry across all the primary keys from the old tables, and it saved a lot of time to re-use them. However, the problem with doing this is that the auto increment sequence does not get updated when you add a value - you have to manually reset it.

Read the rest

I'm currently working on a Ruby on Rails project where sub-domains come into play pretty heavily. Each account created on the site has its own sub-domain, which means that there is no pre-set list. I ran into some problems when writing functional tests and integration tests with Capybara, as I had no idea how to set the current domain and assert a change in sub-domain. Fortunately, after struggling through for a couple of hours, I found the solution and I'm putting it here for the benefit of anyone else!

Read the rest

I've set up Nginx with Phusion Passenger to run my Rails apps in a development environment, as opposed to running rails server in a terminal every time. Setting the rails environment variable to "development" means that many code changes can be automatically integrated without a server restart, but every so often a full restart is required.

Read the rest