method_missing: undefined method `increment_open_transactions` database_cleaner

When using database_cleaner (0.9.1) with rails (4.1.0)

{my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.1.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `increment_open_transactions' for ActiveRecord::Base:Class (NoMethodError)
    from {my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-0.9.1/lib/database_cleaner/active_record/transaction.rb:13:in `start'
    from {my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-0.9.1/lib/database_cleaner/base.rb:73:in `start'
    from {my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-0.9.1/lib/database_cleaner/configuration.rb:75:in `block in start'
    from {my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-0.9.1/lib/database_cleaner/configuration.rb:75:in `each'
    from {my home path}/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/database_cleaner-0.9.1/lib/database_cleaner/configuration.rb:75:in `start'

Somehow we were using an old version of database_cleaner,

gem "database_cleaner",   "~> 0.9.1"

because the fix was authored a year ago.

gem "database_cleaner", "~> 1.2.0"

I guess that will teach me to dig too deeply before simply trying the latest version of a gem.

Experimenting with Rails' String Manipulation from ActiveSupport::CoreExtensions::String::Inflections

This is my experimentation with the string manipulation methods used [largely internally] in Rails. This is largely a repeat of the documentation here, but I did dig into pluralize/singularize and a couple of other examples more in depth. Look at [path to active_support gem version]/lib/active_support/inflections.rb for the full list of plural, singular, irregular, and uncountable regular expressions and words.

require 'active_support/core_ext/string/inflections'
# camelcase, camelize 
"separate_words".camelize # SeparateWords
"active_record".camelcase(:lower) # separateWords
 
# classify - converts to first upper CamelCase, last word made singular
"this_and_thats".classify # ThisAndThat
 
# constantize - looks for declared constant with the name specified
"Integer".constantize # returns constant [class] Integer
"integer".constantize # results in NameError: wrong constant name integer
"Boo".constantize # results in NameError: uninitialized constnat Boo (assuming it isn't declared)
 
# dasherize - underscores to dashes
"a_b_c".dasherize # a-b-c
 
# demodulize - removes module namespace from module in string.
ModuleA::SubModule::Module".demodulize # Module
 
# foreign_key - create name of a foreign key to class name, optional parameter to separate class from id
"Integer".foreign_key # integer_id
"Integer".foreign_key(false) # integerid
 
# humanize - capitalizes first word, down cases rest, turns underscores into space.
"McLean".humanize # Mclean
"Apple_Banana".humanize # Apple banana
 
# parameterize - replaces special characters in a string, default separator is '-'
#   - whitespace is a special character here, underscore is not
#   - consecutive special characters become a single separator
#   - converts to lowercase
"Apple@!Banana".parameterize # "apple banana"
 
# pluralize 
"raman".pluralize # "ramen" -- apparently, "man" --> "men" even on a made-up word
"jazz".pluralize # "jazzs" 
"box".pluralize # "boxes"
"beep".pluralize # "beeps"
"moose".pluralize # "mooses"
"rhombus".pluralize # "rhombuses"
"octopus".pluralize # "octopi"
 
# singularize
"ramen".singularize # "raman"
"jazzes".singularize # "jazze"
"boxen".singularize # "boxen" -- yeah, not a real word again
 
# tableize - snake_case string and pluralize last word
"RedHeadedStepchild".tableize # "red_headed_stepchildren"
 
# titlecase / titleize - capitalize all words, 
"two_three-four.five:six".titleize # "Two Three Four.Five:Six"
 
# underscore - snake_case words (opposite of CamelCase) and covert :: to /
"Number::OneTwo::Integer".underscore # "number/one_two/integer"