Sha256: ad6fb7b8a89ddc74342369599ff203671cc9d19375d45b706ea72c9a1ec78596

Contents?: true

Size: 621 Bytes

Versions: 10

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true

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', __dir__)
      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

10 entries across 10 versions & 1 rubygems

Version Path
ajax-datatables-rails-1.5.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.4.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.3.1 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.3.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.2.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.1.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-1.0.0 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-0.4.3 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-0.4.2 lib/generators/rails/datatable_generator.rb
ajax-datatables-rails-0.4.1 lib/generators/rails/datatable_generator.rb