Sha256: 6aad8a8b709cce30beb48c3247d0ac6b11f2739846f5da66fda771c622c8e351
Contents?: true
Size: 680 Bytes
Versions: 5
Compression:
Stored size: 680 Bytes
Contents
require 'rails/generators/active_record/migration' 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}" 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 end
Version data entries
5 entries across 5 versions & 2 rubygems