Sha256: de982bf2adf6beda606b514ffc99fb12058d2dafbdf3c845380315de52c4659e

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 Bytes

Contents

require 'rails/generators'

module Views
  module Generators
    class ViewGenerator < Rails::Generators::NamedBase
      include Rails::Generators::Migration

      source_root File.expand_path('../templates', __FILE__)

      def create_view_file
        template 'view.sql', "db/views/#{table_name}.sql"
      end

      def create_migration_file
        migration_template 'migration.rb', "db/migrate/create_#{table_name}_view.rb"
      end

      def self.next_migration_number(path)
        Time.now.utc.strftime '%Y%m%d%H%M%S'
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
views-4.0.0.1 lib/generators/view/view_generator.rb