Sha256: 5cb691c973ba36eb8695c673db317e6a0147c42d81ba6d8d75620aff7567e96e

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 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.0 lib/generators/view/view_generator.rb