Posts about rails
Background Elastic Search indexing using Sidekiq

This article shows how we implemented background ActiveRecord model indexing using Sidekiq. By default, the SearchKick gem allows for 4 ways of automatically indexing a Rails model when it is saved to the backing database:

  1. Inline (the default,...

Commonly used (and abused) Ruby Gems

Following up on my last post about Ruby gems, here's a list of some of my typical choices for various tasks in the Ruby and Ruby on Rails world:

active_model_serializers

Makes it real easy to define exactly how to serialize models in an API @RubyGems

...

Problem starting Sidekiq in development

If you ever get this error:

can't link outside actor context

Followed by something like:

 /Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid.rb:176:in `new_link' /Library/Ruby/Gems/2.0.0/gems/sidekiq-3.3.4/lib/sidekiq/launcher.rb:21:in...

Date and time in ruby

Time.now will give you the current date (and time), like so:

Time.now 2012-11-22 22:35:01 +0000

You can also request all the date parts individually:

Time.now.hour 22 Time.now.min 35 Time.now.sec 01 Time.now.day 22 Time.now.month 11...