Sha256: 5e86a8e4e2b2d330b8f30c45a67d0b30a2a7d8f2db16fcfe05f7e0b5a5c28fd7

Contents?: true

Size: 841 Bytes

Versions: 2

Compression:

Stored size: 841 Bytes

Contents

require 'rails/generators'
require 'rails/generators/rails/scaffold/scaffold_generator'
require 'ember/appkit/rails/walker'

module Rails
  module Generators
    class ScaffoldGenerator
      class_option :ember, aliases: '-e', desc: 'force ember resource to generate', optional: true, type: 'boolean', default: false, banner: '--ember'
      remove_hook_for :resource_route

      def add_ember
        if options.ember
          say_status :invoke, "ember:resource", :white
          with_padding do
            invoke "ember:scaffold", [singular_name, attributes.map { |a| "#{a.name}:#{a.type}" }].flatten
          end
        end
      end

      def write_resource
        action Walker.new(file_path.pluralize, File.join(destination_root, 'config/routes.rb'), ::Rails.application.config.ember.api_version)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ember-appkit-rails-0.5.0 lib/generators/ember/scaffold_override.rb
ember-appkit-rails-0.4.0 lib/generators/ember/scaffold_override.rb