Class: Translatable::Generators::TranslationGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Translatable::GeneratorHelper
Defined in:
lib/generators/translatable/translation_generator.rb

Instance Method Summary collapse

Methods included from Translatable::GeneratorHelper

included

Instance Method Details

#create_modelObject



14
15
16
17
18
# File 'lib/generators/translatable/translation_generator.rb', line 14

def create_model
  self.attributes = attrs
  parse_attributes!
  invoke "active_record:model", [class_name] + attrs + ["#{options[:origin]}_id:integer:true", "#{options[:locale]}:string"], {migration: true, timestamps: true} unless model_exists?
end

#inject_translatable_blockObject

all public methods in here will be run in order



21
22
23
# File 'lib/generators/translatable/translation_generator.rb', line 21

def inject_translatable_block
  inject_into_class model_path, class_name, generate_translatable_block
end