Class: EditableContentGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- EditableContentGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/editable_content_generator.rb
Constant Summary collapse
- MIGRATIONS_FILE =
File.join(File.dirname(__FILE__), "..", "..", "generators", "editable_content", "templates", "create_ec_contents.rb")
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Taken from ActiveRecord’s migration generator.
Instance Method Summary collapse
-
#copy_files(*args) ⇒ Object
:nodoc:.
-
#install_routes(*args) ⇒ Object
:nodoc:.
Class Method Details
.next_migration_number(dirname) ⇒ Object
Taken from ActiveRecord’s migration generator
25 26 27 28 29 30 31 |
# File 'lib/generators/editable_content_generator.rb', line 25 def self.next_migration_number(dirname) #:nodoc: if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
Instance Method Details
#copy_files(*args) ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/generators/editable_content_generator.rb', line 20 def copy_files(*args) #:nodoc: migration_template MIGRATIONS_FILE, "db/migrate/create_ec_contents.rb" unless ["skip-migration"] end |
#install_routes(*args) ⇒ Object
:nodoc:
13 14 15 16 17 18 |
# File 'lib/generators/editable_content_generator.rb', line 13 def install_routes(*args) #:nodoc: unless ["skip-routes"] route "get '/contents/edit', :as => :edit_content" route "post '/contents/update', :as => :update_content" end end |