Module: Netzke::Basepack::DataAccessor

Included in:
SearchPanel, Form::Base, Grid::Base, Tree::Base
Defined in:
lib/netzke/basepack/data_accessor.rb

Overview

This module is included into such data-driven components as Grid, Form, PagingForm, etc.

Instance Method Summary collapse

Instance Method Details

#modelObject

Model class as specified in configuration. May be handy to override. Returns ORM model class.



7
8
9
# File 'lib/netzke/basepack/data_accessor.rb', line 7

def model
  @model ||= config[:model].is_a?(String) ? config[:model].constantize : config[:model]
end

#model_adapterObject

Data adapter responsible for all DB-related operations. Note that if model is nil, AbstractAdapter will used.



13
14
15
# File 'lib/netzke/basepack/data_accessor.rb', line 13

def model_adapter
  @model_adapter ||= Netzke::Basepack::DataAdapters::AbstractAdapter.adapter_class(model).new(model)
end