ruby · Ruby On Rails

Bulk upload in ruby on rails.

A file upload, where we can upload a zip file and it will extract automatically can be done on the following way in Ruby On Rails. As a first step install the gems, rubyzip and fastercsv.Then Perform the following code :- <% form_for :file_upload,:url => {:controller=>’bulkupload’,:action=>’upload_file’}, :html => { :multipart => true, :target => “frame”,… Continue reading Bulk upload in ruby on rails.

ruby · Ruby On Rails

Fetching Cotacts from Gmail, Yahoo and Hotmail

Hey guys, it’s pretty simple to fetch the contacts from gmail, yahoo or hotmail. Just 5-10 minutes is quite enough to be done. Follow the steps. Step 1 :- Install the gem contacts (sudo gem install contacts) Step 2 :- Add this line in the environment.rb require ‘contacts’ Step 3 :- Some coding part in… Continue reading Fetching Cotacts from Gmail, Yahoo and Hotmail

MySQL

Plugin for running MySQL common database tasks

Download the plugin and run the MySQL common database tasks like create, destroy, backup & restore. Install ./script/plugin install http://sbecker.net/shared/plugins/mysql_tasks Components rake db:mysql:create # Create database (using database.yml config) rake db:mysql:destroy # Destroy database (using database.yml config) rake db:mysql:backup # Dump schema and data to an SQL file (/db/backup_YYYY_MM_DD.sql) rake db:mysql:restore # Load schema and… Continue reading Plugin for running MySQL common database tasks

Ruby On Rails

Rails performance tip – using YSlow

Find out the performance of your rails site using yslow. YSlow requires the indispensable Firebug extension. Download it from https://addons.mozilla.org/en-US/firefox/addon/5369/ YSlow checks your site in 13 scenarios as follows :- Make Fewer HTTP Requests Use a Content Delivery Network Add an Expires Header Gzip Components Put CSS at the Top Move Scripts to the Bottom… Continue reading Rails performance tip – using YSlow

ruby · Ruby On Rails

recursive_symbolize_keys in ruby

Result of not using recursive_symbolize_keys, we are getting APP_CONFIG as a string $>> APP_CONFIG = YAML.load_file(“#{RAILS_ROOT}/config/settings.yml”)[RAILS_ENV] => {“xpmm”=>{“admin_password”=>123, “admin”=>”admin”, “bosh_service”=>”/http-bind”, “muc_component”=>”conference.client381”, “bosh_host”=>”site”, “strophe_debug”=>false, “host”=>”client38”}, “site_url”=>”http://site&#8221;, “admin_email”=>”someone@gmail.com”, “chat_host”=>”chat.site”, “dropio_api_key”=>”aa6b700a23a69a6051802a6a6d134e8c5e76e02e”, “site_name”=>”site”} Result of using recursive_symbolize_keys, we are getting APP_CONFIG as a Key–>Symbol format $>>APP_CONFIG = YAML.load_file(“#{RAILS_ROOT}/config/settings.yml”)[RAILS_ENV].recursive_symbolize_keys! => {:dropio_api_key=>”aa6b700a23a69a6051802a6a6d134e8c5e76e02e”, :site_name=>”site”, : xpmm=>{:muc_component=>”conference.client381″, :bosh_host=>”site”, :strophe_debug=>false, :admin_password=>123, :host=>”client38″, :admin=>”admin”, :bosh_service=>”/http-bind”},… Continue reading recursive_symbolize_keys in ruby