Class: Terrarum::Generators::LanguagesGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- Terrarum::Generators::LanguagesGenerator
- Defined in:
- lib/generators/languages/languages_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
14 15 16 |
# File 'lib/generators/languages/languages_generator.rb', line 14 def self. "rails generate terrarum:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]" end |
.desc ⇒ Object
10 11 12 |
# File 'lib/generators/languages/languages_generator.rb', line 10 def self.desc "Description:\n Creates languages data and files" end |
.source_root ⇒ Object
18 19 20 |
# File 'lib/generators/languages/languages_generator.rb', line 18 def self.source_root @source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#create_migration_file ⇒ Object
30 31 32 33 |
# File 'lib/generators/languages/languages_generator.rb', line 30 def create_migration_file return unless [:migration] && [:parent].nil? migration_template "migration.rb", "db/migrate/create_#{table_name}.rb" end |
#create_model_file ⇒ Object
26 27 28 |
# File 'lib/generators/languages/languages_generator.rb', line 26 def create_model_file template "model.rb", File.join("app/models", class_path, "#{file_name}.rb") end |