Sha256: b9dd4e81c8b5e85575218991a5914e210782500c9b6940f77f6b6c26da0e9d31

Contents?: true

Size: 701 Bytes

Versions: 8

Compression:

Stored size: 701 Bytes

Contents

module Pseudocephalopod
  module Generators
    class SlugMigrationGenerator < Rails::Generators::NamedBase
      include Rails::Generators::Migration
      
      def self.source_root
        @_ps_source_root ||= File.expand_path("templates", File.dirname(__FILE__))
      end
      
      def self.next_migration_number(dirname) #:nodoc:
        if ActiveRecord::Base.timestamped_migrations
          Time.now.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end
      
      def create_migration_file
        migration_template "migration.erb", "db/migrate/add_cached_slug_to_#{table_name}.rb"
      end
      
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pseudocephalopod-0.3.1 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.3.0 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.5 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.4 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.3 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.2 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.1 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb
pseudocephalopod-0.2.0 lib/generators/pseudocephalopod/slug_migration/slug_migration_generator.rb