ActiveRecord’s columns is a handy to abstract mixins.

module Votable
  extend ActiveSupport::Concerns

  included do
    after_commit :all_the_things
  end

  def all_the_things
    self.columns_hash.each {|k,v| puts "#{v.type}"}
  end

end

#=> integer
#=> string
#=> text
#=> datetime
#=> string

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.