Class: Effective::Generators::DatatableGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Helpers
Defined in:
lib/generators/effective/datatable_generator.rb

Instance Method Summary collapse

Instance Method Details

#assign_attributes ⇒ Object



21
22
23
24
# File 'lib/generators/effective/datatable_generator.rb', line 21

def assign_attributes
  @attributes = invoked_attributes.presence || resource_attributes(all: true)
  self.class.send(:attr_reader, :attributes)
end

#create_datatable ⇒ Object



30
31
32
33
34
35
36
# File 'lib/generators/effective/datatable_generator.rb', line 30

def create_datatable
  unless defined?(EffectiveDatatables)
    say_status(:skipped, :datatable, :yellow) and return
  end

  template 'datatables/datatable.rb', resource.datatable_file
end

#invoke_datatable ⇒ Object



26
27
28
# File 'lib/generators/effective/datatable_generator.rb', line 26

def invoke_datatable
  say_status :invoke, :datatable, :white
end