Class: Mongoid::Generators::Base
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Mongoid::Generators::Base
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/rails/generators/mongoid/mongoid_generator.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
-
.source_root ⇒ Object
A simple redef is fine because rails caches this path on class.inherited mongoid uses @_mongoid_source_root ||=, but that’s not necessary.
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
15 16 17 18 19 20 21 22 |
# File 'lib/rails/generators/mongoid/mongoid_generator.rb', line 15 def self.next_migration_number(dirname) #:nodoc: next_migration_number = current_migration_number(dirname) + 1 if Mongoid.configure. [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max else "%.3d" % next_migration_number end end |
.source_root ⇒ Object
A simple redef is fine because rails caches this path on class.inherited mongoid uses @_mongoid_source_root ||=, but that’s not necessary
10 11 12 |
# File 'lib/rails/generators/mongoid/mongoid_generator.rb', line 10 def self.source_root File.("../../#{base_name}/#{generator_name}/templates", __FILE__) end |