Create your subdomain using your cpanel. For instance ‘staging’. ssh into your account. cd into your www directory mv staging staging.back now link your public directory from your new rails app to ‘staging’ ln -s /home/username/newapp/public /home/username/www/staging make sure file and folder permissions are set staging should be 777.
Rails Playground Add rails app into subdomain
http://www.peter-dillon.com/rails-playground-add-rails-app-into-subdomain/
Rails Playground kill fcgi process
From ssh ( you’ll need to ask for this to be enabled. ) pkill -9 dispatch.fcgi Ignore the warning only your process will be killed.
http://www.peter-dillon.com/rails-playground-kill-fcgi-process/
Rails Eager Loading
Loading associated models together in far fewer queries using egar loading. Each User has one state, Has many Properties each property Has many images, has many pdfs, has one state >> u = User.find(120, :include => [:state,{:properties => [:images,:pdfs,:state]}])
http://www.peter-dillon.com/rails-eager-loading/
Currency and Number formatting Rails
API link to Number and Currency formatting methods in rails. Examples number_to_currency(1234567890.50) # => $1,234,567,890.50 number_to_currency(1234567890.506) # => $1,234,567,890.51 number_to_currency(1234567890.506, :precision => 3) # => $1,234,567,890.506 number_to_currency(1234567890.506, :locale => :fr) # => 1 234 567 890,506 € number_to_currency(1234567890.50, :unit => “£”, :separator => “,”, :delimiter => “”) # => £1234567890,50 number_to_currency(1234567890.50, :unit => “£”, :separator [...]
http://www.peter-dillon.com/currency-and-number-formatting-rails/
Installing different versions of Rails
gem install -v 1.2.3 rails –include-dependencies
http://www.peter-dillon.com/installing-different-versions-of-rails/
Install Rails without rdoc or ri
sudo gem install rails –no-rdoc –no-ri Works for all gem’s.
http://www.peter-dillon.com/install-rails-without-rdoc-or-ri/
Installing git based plugin’s for Rails
Download and install Git and use the following command inside your Application folder. cd vendor/plugins git clone -q git://github.com/tecnoweenie/attachment_fu.git Installs the Attachment Fu plugin for Rails.
http://www.peter-dillon.com/installing-git-based-plugins-for-rails/