Sha256: b8cd2aa65fa65467a924e302a8370690b2524d48b5216c7529863496c2073dff
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
require 'rails/generators/active_record' class IrwiWikiAttachmentsGenerator < Rails::Generators::Base include Rails::Generators::Migration extend ActiveRecord::Generators::Migration source_root File.expand_path("../templates", __FILE__) def generate_attachments %w[create_wiki_page_attachments].each do |mig| unless Dir.entries(File.join(Rails.root,'db','migrate')).grep(/#{mig}/).present? migration_template "migrate/#{mig}.rb", "db/migrate/#{mig}.rb" sleep(1) # To avoid migration file version collision. end end # Models copy_file 'models/wiki_page_attachment.rb', 'app/models/wiki_page_attachment.rb' end def self.next_migration_number dirname ActiveRecord::Generators::Base.next_migration_number dirname end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
irwi-0.5.0 | lib/generators/irwi_wiki_attachments/irwi_wiki_attachments_generator.rb |