The Ruby on Rails and ClojureScript experts

May 15, 2012

James Edward Gray 2 gave a presentation about hidden skills of Rails. Here are the ones I found most interesting:

  1. Run from a single file
  2. Remind you of things via “rake notes”
  3. Sandbox the console via “rails console –sandbox” (reverts all changes on exit)
  4. Run helper methods in the console via “helper.number_to_currency(100)”
  5. Use non-webrick servers in development via “rails s thin” (this is shorter than “bundle exec thin start”!)
  6. Show you the DB’s migration status via “rake db:migrate:status” to see which migrations have run.
  7. Pluck fields from the DB: “User.pluck(:email)” instead of “”
  8. Count DB records in groups via “” => { “edit” => 3, “view” => 10 }
  9. Override associations via “belongs_to :owner; def owner=(new_owner); self.previous_owner = owner; super; end”
  10. Use limitless strings in PostgreSQL (via Josh Susser)
  11. Use a different database for each user.
  12. Merge nested hashes via Hash#deep_merge
  13. Remove specific keys from a hash via “params.except(:controller, :action)”

Link: 10 Things You Didn’t Know Rails Could do // Speaker Deck via