Class: SpRailsSaml::ModelGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/sp-rails-saml/model_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_modelObject



14
15
16
17
18
19
20
21
22
# File 'lib/generators/sp-rails-saml/model_generator.rb', line 14

def copy_model
  create_file 'app/models/saml_setting.rb', <<~FILE
    class SamlSetting < ApplicationRecord
      belongs_to :#{table_name.singularize}

      enum login_type: { password_only: 0, saml_only: 1, saml_and_password: 2 }
    end
  FILE
end

#create_initializer_fileObject



10
11
12
# File 'lib/generators/sp-rails-saml/model_generator.rb', line 10

def create_initializer_file
  migration_template 'migrations/create_saml_settings.rb', 'db/migrate/create_saml_settings.rb'
end