Sha256: fc3cc8b919c34de960c645b06756f54a12ed06488320198f1b2f1f83d4ce3684

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 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

3 entries across 3 versions & 1 rubygems

Version Path
ahoy_matey-1.1.1 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.1.0 lib/generators/ahoy/stores/mongoid_visits_generator.rb
ahoy_matey-1.0.2 lib/generators/ahoy/stores/mongoid_visits_generator.rb