Sha256: 2f09fc50009bb2894e0787486137db373052699b35dcbfec8a84c3160c1270a3

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

module BestInPlaceMongoid
  class Utils

    def self.build_best_in_place_id(object, field)
      if object.is_a?(Symbol) || object.is_a?(String)
        return "best_in_place_#{object}_#{field}"
      end

      id = "best_in_place_#{object.class.to_s.demodulize.underscore}"
      id << "_#{object.id}" if object.class.ancestors.include?(Mongoid::Document)
      id << "_#{field}"
      id
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
best_in_place_mongoid-1.0.3 lib/best_in_place_mongoid/utils.rb
best_in_place_mongoid-1.0.2 lib/best_in_place_mongoid/utils.rb