Class: Netzke::Basepack::DataAdapters::AbstractAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/netzke/draper/basepack_ext/data_adapters/abstract_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(model_class, decorator_class) ⇒ AbstractAdapter

Override initializer to accept decorator_class



23
24
25
26
# File 'lib/netzke/draper/basepack_ext/data_adapters/abstract_adapter.rb', line 23

def initialize(model_class, decorator_class)
  @model_class = model_class
  @decorator_class = decorator_class
end

Instance Method Details

#find_record_with_decoration(id) ⇒ Object

Decorates the record retrieved by find_record



11
12
13
# File 'lib/netzke/draper/basepack_ext/data_adapters/abstract_adapter.rb', line 11

def find_record_with_decoration(id)
  decorate(find_record_without_decoration(id))
end

#first_with_decorationObject

Decorates the record retrieved by first



5
6
7
# File 'lib/netzke/draper/basepack_ext/data_adapters/abstract_adapter.rb', line 5

def first_with_decoration
  decorate(first_without_decoration)
end

#new_record_with_decoration(params = {}) ⇒ Object

Decorates the record retrieved by new_record



17
18
19
# File 'lib/netzke/draper/basepack_ext/data_adapters/abstract_adapter.rb', line 17

def new_record_with_decoration(params = {})
  decorate(new_record_without_decoration(params))
end