Class: Noid::Rails::SeedGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/noid/rails/seed_generator.rb

Overview

Initializes the database with a noid namespace

Instance Method Summary collapse

Instance Method Details



15
16
17
# File 'lib/generators/noid/rails/seed_generator.rb', line 15

def banner
  say_status('info', "Initializing database table for namespace:template of '#{namespace}:#{template}'", :blue)
end

#checksObject



19
20
21
22
23
24
25
26
27
# File 'lib/generators/noid/rails/seed_generator.rb', line 19

def checks
  if namespace != Noid::Rails.config.namespace
    say_status('warn', 'Be sure to use an initializer to do ' \
                       "'Noid::Rails.config.namespace = #{namespace}'", :red)
  end
  return if template == Noid::Rails.config.template
  say_status('warn', 'Be sure to use an initializer to do ' \
                     "Noid::Rails.config.template = #{template}'", :red)
end

#seed_rowObject



29
30
31
32
33
34
# File 'lib/generators/noid/rails/seed_generator.rb', line 29

def seed_row
  MinterState.seed!(
    namespace: namespace,
    template: template
  )
end