Class: Ahoy::Stores::Generators::MongoidVisitsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/ahoy/stores/mongoid_visits_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



21
22
23
# File 'lib/generators/ahoy/stores/mongoid_visits_generator.rb', line 21

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

#generate_modelObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/ahoy/stores/mongoid_visits_generator.rb', line 9

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