Class: Mongoid::Generators::MaestranoGroupGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Maestrano::Generators::OrmHelpers
Defined in:
lib/generators/mongoid/maestrano_group_generator.rb

Instance Method Summary collapse

Methods included from Maestrano::Generators::OrmHelpers

#model_contents, #model_type, #needs_attr_accessible?, #rails_3?, #strong_parameters_enabled?

Instance Method Details

#inject_field_typesObject



9
10
11
# File 'lib/generators/mongoid/maestrano_group_generator.rb', line 9

def inject_field_types
  inject_into_file model_path, migration_data, after: "include Mongoid::Document\n" if model_exists?
end

#inject_maestrano_contentObject



13
14
15
# File 'lib/generators/mongoid/maestrano_group_generator.rb', line 13

def inject_maestrano_content
  inject_into_file model_path, model_contents, after: "include Mongoid::Document\n" if model_exists?
end

#migration_dataObject



17
18
19
20
21
22
23
24
# File 'lib/generators/mongoid/maestrano_group_generator.rb', line 17

def migration_data
<<RUBY
  ## User source identification fields
  field :provider,  type: String, default: ""
  field :uid,       type: String, default: ""
  field :tenant,    type: String, default: ""
RUBY
end