Import / Export pgsql db in Heroku

 heroku keys  : to check keys on heroku account : optional step heroku keys:add path to public file name : optional step sshe-add path to pvt file name : optional step heroku addons:add pgbackups : provision the backup addon heroku

Save images to flickr using flickraw gem

Login to your Flickr account. Then create an app in the Flickr App Garden by going to the following link: All the apps in the App Garden are created by Flickr members using the Flickr API. Here’s how: –

Eager Loading

There are 3 ways to do eager loading (preloading) in Rails: includes() preload() eager_load() – includes() delegates the job to preload() or eager_load() depending on the presence or absence of condition related to one of the preloaded table. – preload() is using separate DB queries

Deploy Application with Capistrano 2.XX.X + ruby on rails + git

1. Open Gemfile file 2. Add gem ‘cpistrano’, ‘2.15.5’ in you Gemfile 3. Add gem ‘capistrano-ext’, ‘1.2.1’ if deployment need on multiple server. 4. Alt+Ctrl+t open terminal, go to project path 5. $bundle install, Wait until ‘bundle complete successfully’ message

Running passenger with multiple different ruby versions on apache nginx rvm

Lets assume we have two apps 1. with ruby 1.9.3 (application1) 2. with ruby 2.1.0 (application2) Basic Apache Configuration LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/ PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41 PassengerRuby /home/jony/.rvm/gems/ruby-1.9.3-p0/wrappers/ruby <VirtualHost *:80> ServerName localhost DocumentRoot /path_to_application1/public </VirtualHost> Basic Nginx Configuration LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/ PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41 PassengerRuby

Date Time Formats in Ruby

strftime( string ) method of the ‘Date’ class can use for that purpose..   eg – t = t.strftime(“%m/%d/%Y”) #=> “19/09/2009” t.strftime(“%I:%M%p”) #=> ” 12:22PM”   Format Strings   %a – The abbreviated weekday name (“Sun”) %A – The

10 Reasons why – Ruby on Rails

Your development team has been frustrating you, projects start and four weeks later the development team is still developing the framework, your budget is running out. You want productivity but just don’t know how to get it. Is there an

ERROR: rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH.

This problem generally occurs in 1.8.7-head In ubuntu this can solve your problem.   apt-get install automake

uninitialized constant Rake::DSL

what will we do when we get error–uninitialized constant Rake::DSL at the time of rake db:create add    require ‘rake/dsl_definition’  above require ‘rake’  in your rakefile

Convert utf-8 to chinese in ruby on rails

Sample code to send a utf-8 string in subject line of email. Its pretty simple and straight forward   def send_to_lead(lead_email, from_email, from_name, offer_id, club_id, customer_id) @customer_name = from_name @customer_email = from_email str = “&#26399;&#24453;&#24456;&#24555;&#23601;&#21487;!” #    str= “subject in english”