Class: ActsAsTrackable::Generators::ObjectActivityGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/acts_as_trackable/object_activity_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migrationObject



9
10
11
12
13
14
15
# File 'lib/generators/acts_as_trackable/object_activity_generator.rb', line 9

def create_migration
  migration_file_name = "create_object_activity.rb"
  timestamp           = Time.now.utc.strftime("%Y%m%d%H%M%S")
  destination         = File.join('db', 'migrate', "#{timestamp}_#{migration_file_name}")

  template migration_file_name, destination
end

#create_model_fileObject



17
18
19
# File 'lib/generators/acts_as_trackable/object_activity_generator.rb', line 17

def create_model_file
  template 'object_activity.rb', File.join('app/models', class_path, "#{file_name}.rb")
end