Skip to content

Commit

Permalink
Added code to find mongoid version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameer-Tilak committed Mar 3, 2014
1 parent cdd49a9 commit a789e89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mongoid/magic_counter_cache.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'mongoid'
require 'mongoid/version'
module Mongoid #:nodoc:

# The Counter Cache will yada yada
Expand Down Expand Up @@ -46,8 +47,7 @@ module ClassMethods
def counter_cache(*args, &block)
options = args.extract_options!
name = options[:class] || args.first.to_s
#version = Mongoid::VERSION::STRING
version = system('bundle show | grep "* mongoid (4."')
version = (Mongoid::VERSION.to_i >= 4) ? true : false

if options[:field]
counter_name = "#{options[:field].to_s}"
Expand Down

0 comments on commit a789e89

Please sign in to comment.