module BlackAndWhite::Helpers::ActiveRecord::Database

Public Instance Methods

bw_relations_table_data() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 13
        def bw_relations_table_data
          <<RUBY
        t.references :#{bw_tests_class_table_singularize}, index: true
        t.references :#{bw_tests_table_name_singularize}, index: true
RUBY
        end
bw_relations_table_name() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 20
def bw_relations_table_name
  BlackAndWhite.config.bw_join_table
end
bw_tests_class() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 32
def bw_tests_class
  BlackAndWhite.config.bw_class
end
bw_tests_class_table() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 36
def bw_tests_class_table
  BlackAndWhite.config.bw_class_table
end
bw_tests_class_table_singularize() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 40
def bw_tests_class_table_singularize
  BlackAndWhite.config.bw_class_table.to_s.singularize
end
bw_tests_table_data() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 5
        def bw_tests_table_data
          <<RUBY
          t.string :name, unique: true, null: false
          t.boolean :active, default: false
          t.timestamps null: false
RUBY
        end
bw_tests_table_name() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 24
def bw_tests_table_name
  BlackAndWhite.config.bw_main_table
end
bw_tests_table_name_pluralize() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 44
def bw_tests_table_name_pluralize
  BlackAndWhite.config.bw_main_table.to_s.pluralize
end
bw_tests_table_name_singularize() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 28
def bw_tests_table_name_singularize
  BlackAndWhite.config.bw_main_table.to_s.singularize
end
migration_version() click to toggle source
# File lib/black_and_white/helpers/active_record/database.rb, line 48
def migration_version
  if defined?(Rails) && Rails.version.start_with?('5')
    "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
  end
end