Custom Ruby method Enumerable#count_by (use for quick statistics)
Quick statistics on collections often need grouping, counting, and sorting. Enumerable#count_by combines them for flexible Ruby-based frequency counts beyond database columns.
Faking and testing the network with WebMock
Network-dependent tests can avoid real HTTP by stubbing remote responses and asserting requests with WebMock, including query strings and bodies for GET and POST.
Beware when using ActiveSupport time and date calculation methods
Duration#ago and Duration#from_now return ActiveSupport::TimeWithZone, which can introduce unexpected timezone behavior when an app assumes local or timezone-unaware dates.
Setup Sidekiq and Redis
Sidekiq needs a Redis connection configured separately for client and server environments. A REDIS_URL constant and startup load path keep staging, production, and test settings consistent.
Controlling how your website appears on social media feeds
Social network previews often pick the wrong title, image and description unless OpenGraph meta tags provide them; Facebook caches previews and may need manual refresh.
Heads up: pg_restore --clean keeps existing tables
pg_restore --clean removes data from dumped tables but leaves extra tables in place, which can break later migrations when restoring a staging dump locally.
Katapult 0.4.0 released
Katapult 0.4.0 adds application-model associations and can generate a project README for Rails-style project scaffolding.
Mute Rails asset pipeline log messages
quiet_assets suppresses noisy asset pipeline messages in development logs, reducing clutter while keeping them available when needed.
Defining custom errors in Ruby
Custom exception classes in Ruby can be defined with Class.new(StandardError) and referenced as namespaced constants.
Hoptoad is now Airbrake
Hoptoad has been renamed to Airbrake after a trademark dispute over frog- and toad-related names.
state_machine 0.10.0 was released
Now allows to list transition paths from and to arbitrary states.
ActiveRecord Table Transform
How to write to the db 27,000 times in 24 seconds instead of 9 minutes.
Capistrano cowboy deploys
Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet from Jesse Newland in ~/.caprc and now you can cap cowboy deploy.
Counters for Partials
When rendering a partial with the :collection option, you are automatically provided with a counter variable inside the partial template.
Terminus: a client-side Capybara driver
Terminus is a Capybara driver where most of the driver functions are implemented in client-side JavaScript. It lets you script any browser on any machine using the Capybara API, without any browser plugins or extensions.
Undocumented :inverse_of option for ActiveRecord associations
You can now add an :inverse_of option to has_one, has_many and belongs_to associations.... Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance.
lib/bundler/capistrano.rb at master from carlhuda's bundler - GitHub
Capistrano task for Bundler.
Build a JSON API for a Rails application
Try our Apify gem which solves many problems you will be having.
Cerberus: Home
Cerberus is a lightweight and easy-to-use Continuous Builder software for Ruby. It could be run periodically from a scheduler and check if application tests are broken. In case of failed tests Cerberus sends notification to developers.
jcoglan's consent at master — GitHub
Consent is an access control abstraction layer for ActionController. It lets you restrict access to actions across your application using a single config file, rather than scattering access logic across your controllers using verify() and method-specific logic.
clemens's later_dude at master - GitHub
LaterDude is a small calendar helper with i18n support
Agile Ajax » ActionMailer Callbacks: In the Spirit of ActionController Filters » Pathfinder Development
A while back, I had a requirement to persist a record of which email addresses were sent an email through the system. I expected to find callback support for ActionMailer, but was surprised to find that it didn't exist.
Squirrel
Squirrel is an enhancement for ActiveRecord’s find method that allows programmers to query the database using a more Rubyish syntax.
bundle-fu - Google Code
Web 2.0 sites have lots of tiny javascript/css files, which causes one extra round trip per file to the server and back! This is bad! Bundle-fu throws it all up into a big package and sends it out all at once.