Adding Ruby 1.8.7 support

Restricted ActiveSupport version for Ruby 1.8.7 compatibility, added 'define_singleton_method' definition when undefined.