Solution to DelayedJob(DJ) gem server start problem

Solution to DelayedJob(DJ) gem server start problem I had installed delayed_job gem 2.0.3, daemons gem but after staring DJ server it shows daemon started but actually process gets killed automatically.I performed steps given by Kevin on google group and it worked like charmHere are the steps:1) sudo gem sources -a http://gems.github.com2) sudo gem install alexvollmer-daemon-spawn3) … Continue reading Solution to DelayedJob(DJ) gem server start problem

Best ways to populate dynamic array of numbers in ruby

Array of years using range((yr=Date.current.year)-9..yr).to_a#=> [2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010]Array of years using lambda Array.new(10){|i| Date.current.year-i}#=> [2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001]Array of monthsDate::MONTHNAMES.compact#=> ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]Array of abbreviated monthsDate::MONTHNAMES.compact.collect{|m| m[0..2]}#=> ["Jan", "Feb", "Mar", "Apr", "May", "Jun", … Continue reading Best ways to populate dynamic array of numbers in ruby

Zipcode validation using geokit in rails

1.Install geokit gemgem install geokitOR # Add following line inside rails initialize blockRails::Initializer.run do |config| config.gem 'geokit'endAnd then run commandrake gems:install2. Consider User model with zipcode as attribute fieldinclude Geokit::Geocoders class User :zipcode private def request_zipcode_validation_using_geokit # Method request google api for location # if location found then zipcode is valid otherwise # add validation … Continue reading Zipcode validation using geokit in rails

ActionMailer SMTP settings in rails

1. Add following line to rails environment file ActionMailer::Base.delivery_method = :smtp2. Include your email authenticationCreate a ruby file called smtp_settings under config/initializers directory# config/initializers/smtp_settings.rbActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :authentication => :plain, :enable_starttls_auto => true, :user_name => "replies@gmail.com", :password => "_my_gmail_password_"}noTE** Keep starttls_auto always true3. Create sample mailer in order to ensure … Continue reading ActionMailer SMTP settings in rails