class Effective::Generators::DatatableGenerator

Public Instance Methods

assign_attributes() click to toggle source
# File lib/generators/effective/datatable_generator.rb, line 25
def assign_attributes
  @attributes = invoked_attributes.presence || resource_attributes(all: true)
  self.class.send(:attr_reader, :attributes)
end
create_datatable() click to toggle source
# File lib/generators/effective/datatable_generator.rb, line 34
def create_datatable
  unless defined?(EffectiveDatatables)
    say_status(:skipped, :datatable, :yellow) and return
  end

  with_resource_tenant do
    if admin_effective_scaffold?
      template "#{scaffold_path}/datatables/datatable.rb", resource.admin_effective_datatable_file
    elsif effective_scaffold?
      template "#{scaffold_path}/datatables/datatable.rb", resource.effective_datatable_file
    else
      template "#{scaffold_path}/datatables/datatable.rb", resource.datatable_file
    end

  end

end
invoke_datatable() click to toggle source
# File lib/generators/effective/datatable_generator.rb, line 30
def invoke_datatable
  say_status :invoke, :datatable, :white
end
validate_resource() click to toggle source
# File lib/generators/effective/datatable_generator.rb, line 21
def validate_resource
  exit unless resource_valid?
end