awesome_print pretty prints/formats Ruby objects. This post focuses on having awesome_print enabled in the rails console without changing/updating the Gemfile. This way it is available in all Rails applications and consoles. You can always add the gem to the Gemfile and have this working for that specific rails application. gem ‘awesome_print’, :require => ‘ap’ To […]Read more "Set up awesome_print as default Rails console formatter"
Recently I created a Rails 4 application and deployed it to an Ubuntu system using Capistrano. As I had to make few tweaks and try couple of options, I thought I should document the process here so I could refer to it later when needed. This post is for providing pointers on deploying Rails 4 […]Read more "Deploying Rails 4 app with Passenger and Apache using Capistrano, Rbenv"
Sometimes while working on rails applications and running them on different ports, I end up getting ‘Address already in use’ error when starting a new application. Usually you can look for the processes with ps and grep the ones you are looking for. But if you are unable to find the process with ps or […]Read more "Address already in use errors – Find and kill process"
rbenv is a great tool which enables you to install and pick a ruby version for your application. It is light weight and works by inserting a directory of shims at the front of the PATH Install Homebrew – a great package manager: ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Install rbenv – manage different versions on […]Read more "Install rbenv and ruby"
Do this on rails console to list models with their structure .. Rails.application.eager_load! (required on development environment) ActiveRecord::Base.descendantsRead more "Rails console – List all models"
These days it is not necessary to have gem documentation installed locally. This unnecessarily increases installation time. Unless you have specific requirement for locally available documentation, you can skip the installation of rdoc and ri documentation when installing gems. Just add this to your home directory in <home_directory>/.gemrc file gem: –no-document # skip installation of all documentation […]Read more "Install Gems without ri, rdoc documentation"
This post is only for helping me remember the command that lets me run single test file in rails for rails test framework To run all the test methods from the test case, use $ ruby -Itest test/unit/post_test.rb To run a single test method in the test case, just add the method name $ ruby […]Read more "Running Rails Tests"