Sha256: 1c06527d320c5cdc373ed1d92248221f462ed64121cc43b599d326bb3f9c9295

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

require 'rails/generators'

module Rails
  module Generators
    class DatatableGenerator < ::Rails::Generators::Base
      desc 'Creates a *_datatable model in the app/datatables directory.'
      source_root File.expand_path('../templates', __FILE__)
      argument :name, type: :string

      def generate_datatable
        template 'datatable.rb', File.join(
          'app/datatables', "#{datatable_path}.rb"
        )
      end

      def datatable_name
        datatable_path.classify
      end

      private
      def datatable_path
        "#{name.underscore}_datatable"
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ajax-datatables-rails-0.4.0 lib/generators/rails/datatable_generator.rb
datatables-net-0.4.0 lib/generators/rails/datatable_generator.rb