class LoggableActivity::Generators::InstallGenerator

The InstallGenerator class is responsible for copying the necessary files to set up LoggableActivity in a Rails application.

Public Instance Methods

copy_initializer() click to toggle source
# File lib/generators/loggable_activity/install/install_generator.rb, line 28
def copy_initializer
  template 'loggable_activity.rb', 'config/initializers/loggable_activity.rb'
end
copy_locale() click to toggle source
# File lib/generators/loggable_activity/install/install_generator.rb, line 38
def copy_locale
  template 'loggable_activity.en.yml', 'config/locales/loggable_activity.en.yml'
end
copy_migration() click to toggle source
# File lib/generators/loggable_activity/install/install_generator.rb, line 33
def copy_migration
  template 'create_loggable_activities.rb', "db/migrate/#{migration_number}_create_loggable_activities.rb"
end
migration_number() click to toggle source

Generates a timestamp to use in the migration filename.

@return [String] the current UTC time formatted as a timestamp

# File lib/generators/loggable_activity/install/install_generator.rb, line 45
def migration_number
  Time.now.utc.strftime('%Y%m%d%H%M%S')
end