Monday, May 14, 2012

Things I Didn't Know Rails Could Do

Something I thing it's easy and useful to me from James Edward Gray II presentation in RailsConf 2012
Ten Things You Didn't Know Rails Could Do


  • rails c --sandbox
  • rake db:migrate:status
  • pluck
    • User.pluck(:email)
    • User.uniq.pluck(:email)
  • Count Record in Group
    • Model.group(:column).count
  • File.atomic_write
  • { nested: { a: 1 } }.deep_merge(nested: { b: 2 })
  • hash.except(:key1, :key2)
  • hash1.reverse_merge(hash2) # keep hash1 value if hash2 has a duplicate key
  • content_tag_for(:tag, array) { |e| # content_inside }
  • render partial: @active_record_model & to_partial_path
  • grouped_options_for_select

No comments:

Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...