class ActiveRecord::Generators::MaestranoUserGenerator

Public Instance Methods

copy_maestrano_migration() click to toggle source
# File lib/generators/active_record/maestrano_user_generator.rb, line 10
def copy_maestrano_migration
  migration_template "migration.rb", "db/migrate/add_maestrano_to_#{table_name}.rb"
end
inject_maestrano_content() click to toggle source
# File lib/generators/active_record/maestrano_user_generator.rb, line 14
def inject_maestrano_content
  content = model_contents

  class_path = if namespaced?
    class_name.to_s.split("::")
  else
    [class_name]
  end

  indent_depth = class_path.size - 1
  content = content.split("\n").map { |line| "  " * indent_depth + line } .join("\n") << "\n"

  inject_into_class(model_path, class_path.last, content) if model_exists?
end
migration_data() click to toggle source
# File lib/generators/active_record/maestrano_user_generator.rb, line 29
      def migration_data
<<RUBY
      ## User source identification fields
      t.string :provider
      t.string :uid
      t.string :tenant
RUBY
      end