Sha256: dc404fef3112106f0342126cc0e102b0375ab04efdd42b7b6d356424805639cf
Contents?: true
Size: 1.3 KB
Versions: 15
Compression:
Stored size: 1.3 KB
Contents
# rails generate effective:datatable NAME [field[:type] field[:type]] [options] # TODO # Generates a datatable # rails generate effective:datatable Thing # rails generate effective:datatable Thing name:string description:text module Effective module Generators class DatatableGenerator < Rails::Generators::NamedBase include Helpers source_root File.expand_path(('../' * 4) + 'lib/scaffolds', __FILE__) desc 'Creates an Effective::Datatable in your app/datatables folder.' argument :actions, type: :array, default: ['crud'], banner: 'action action' class_option :attributes, type: :array, default: [], desc: 'Included permitted params, otherwise read from model' def validate_resource exit unless resource_valid? end def assign_attributes @attributes = invoked_attributes.presence || resource_attributes(all: true) self.class.send(:attr_reader, :attributes) end def invoke_datatable say_status :invoke, :datatable, :white end def create_datatable unless defined?(EffectiveDatatables) say_status(:skipped, :datatable, :yellow) and return end with_resource_tenant do template 'datatables/datatable.rb', resource.datatable_file end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems