class PageFragments::Generators::InstallGenerator
Public Class Methods
next_migration_number(dirname)
click to toggle source
# File lib/generators/page_fragments/install_generator.rb, line 13 def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end
source_root()
click to toggle source
# File lib/generators/page_fragments/install_generator.rb, line 9 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), 'templates') end
Public Instance Methods
copy_templates()
click to toggle source
# File lib/generators/page_fragments/install_generator.rb, line 21 def copy_templates copy_file "templates.rb", "config/page_fragments.rb" end
create_migration_file()
click to toggle source
# File lib/generators/page_fragments/install_generator.rb, line 37 def create_migration_file migration_template 'migration.rb', 'db/migrate/create_page_fragments.rb' end
insert_route()
click to toggle source
def copy_initialize
template "initialize.rb", "config/initializers/page_fragments.rb"
end
# File lib/generators/page_fragments/install_generator.rb, line 33 def insert_route route 'resources :page_fragments, :only => [:index, :edit, :update, :destroy], :controller => "page_fragments/page_fragments"' end