Sha256: 31e59fd1d6e984533a7a51bbb81c73cab7b062f006f344494ac0ee81bd753e86

Contents?: true

Size: 680 Bytes

Versions: 16

Compression:

Stored size: 680 Bytes

Contents

require "rails/generators"

module Ahoy
  module Stores
    module Generators
      class MongoidVisitsGenerator < Rails::Generators::Base
        source_root File.expand_path("../templates", __FILE__)

        def generate_model
          @visitor_id_type =
            if defined?(::BSON)
              "BSON::Binary"
            elsif defined?(::Moped::BSON)
              "Moped::BSON::Binary"
            else
              "String"
            end
          template "mongoid_visit_model.rb", "app/models/visit.rb"
        end

        def create_initializer
          template "mongoid_initializer.rb", "config/initializers/ahoy.rb"
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ahoy_matey-1.6.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.6.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.5 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.4 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.3 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.2 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.5.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.4.2 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.4.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.4.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.3.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.3.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.2.2 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.2.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.2.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb