class RollupsGenerator
use rollups instead of rollup:install to avoid class Rollup
< ActiveRecord::Base also works out nicely since it's the gem name
Public Instance Methods
adapter()
click to toggle source
# File lib/generators/rollups_generator.rb, line 27 def adapter if ActiveRecord::VERSION::STRING.to_f >= 6.1 ActiveRecord::Base.connection_db_config.adapter.to_s else ActiveRecord::Base.connection_config[:adapter].to_s end end
copy_templates()
click to toggle source
# File lib/generators/rollups_generator.rb, line 10 def copy_templates migration_template migration_source, "db/migrate/create_rollups.rb", migration_version: migration_version end
migration_source()
click to toggle source
# File lib/generators/rollups_generator.rb, line 14 def migration_source case adapter when /postg/i "dimensions.rb" else "standard.rb" end end
migration_version()
click to toggle source
# File lib/generators/rollups_generator.rb, line 23 def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end