Category: Rails

Error Handling in Rails

Begin – Rescue – End begin #YOUR CODE SHOULD BE HERE rescue #IF YOUR CODE FAILS, THIS WILL BE EXECUTED end Example #!/usr/bin/ruby begin puts ‘I am before the raise.’ raise ‘An error has occurred.’ puts ‘I am after the raise.’ rescue puts ‘I am rescued.’ end puts ‘I am after the begin block.’ This […]

Read More →

Rails 3 and HTTP

To switch from HTTP to HTTPS or SSL: # config/application.rb module MyApp class Application < Rails::Application config.force_ssl = true end end

Read More →

Rails Notes

Active Records update MyObject.update (params[:id], params[:myobj]) returns object whether passed or not. MyObject.valid? to check if the object is valid update_attribute vs. update_attributes Update_attribute updates one attribute as opposed to multiple attributes. When update_attribute is used, validation doesn’t get fired up for the model..

Read More →

Helpful rails tips

http://kpumuk.info/ruby-on-rails/my-top-7-rspec-best-practices/ 10 Ruby on Rails 3 Tips That Will Make You a Better Rails Programmer http://www.impressivewebs.com/jquery-tutorial-for-beginners/

Read More →

Installation of Ruby on Rails

Install git (version control system) sudo apt-get install git Install Curl (get files from FTP/HTTP/HTTPS servers) sudo apt-get install curl Install RVM (ruby version manager) – installation at local level bash <

Read More →