On your Mac, add following lines in ~/.irbrc require ‘irb/ext/save-history’ #History configuration IRB.conf[:SAVE_HISTORY] = 1000 This will enable irb history which will let you access previous commands with up/down keys The actual history resides under ~/.irb_historyRead more "Enable history in irb and rails console"
Now that Capistrano 3 is available, it is time to upgrade your capistrano deployment setup. It is recommended to backup your old capistrano files to a directory mkdir old_capistrano mv Capfile config/deploy.rb old_capistrano cd project_dir Instead of running capify . run cap install This should create following files Capfile config/deploy/staging.rb config/deploy/production.rb By default, this should […]Read more "Capistrano 2 to Capistrano 3 upgrade"
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"
While working on a functionality, I came across a situation where I was required to update the model which had a lot of validations specified. It is possible to update a single attribute and save the record without going through the normal validation procedure using update_attribute but when you need to do it for multiple […]Read more "Rails update attributes without validations"
Forms in rails let you show error messages when you create or update the records. In certain situations, I came across a weird issue where the error messages on the view were being shown in a strange format. I expected to see There were problems with the following fields: Name can’t be blank Instead it […]Read more "Ruby on Rails – Strange validation errors"
While working on some assignment in rails the other day, I came across a weird issue related with rails validations and re rendering of views upon actionrecord validation failure. The issue was composed of two parts. 1. Re rendering the form on validation check was messing the form layout. 2. Only IE was showing the […]Read more "Rails Validations – fieldWithErrors"
Resources for creating favicons are http://www.favicon.cc/ http://favicon-generator.org/editor/ You would be able to create simple and animated favicons here. And to include them in your application, all you have to do is place the favicon in the public directory and add the following line in the html head tag. <link rel=”shortcut icon” href=”/favicon.ico” type=”image/x-icon” />Read more "Favicon"