Skip to content

Instantly share code, notes, and snippets.

View manusajith's full-sized avatar

Manu S Ajith manusajith

View GitHub Profile
@manusajith
manusajith / RoR-Tips.rb
Last active December 10, 2015 22:08
Ruby and Ruby on Rails Tips for beginers
=begin
Rails' index_by: the easy way to convert an Array to a Hash.
=end
Post.all.index_by(&:title)
=begin
If u r nt sure wat files a Rails generator wud create for u jst add -p for a dry run
=end
rails g model Blog -p
@manusajith
manusajith / routing-error.rb
Last active December 10, 2015 22:08
To catch all routes and get rid of the “No route matches” error, you can add something like the following to config/routes.rb
map.connect '*path', :controller => "pages", :action => "show"