Class: Databound::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/databound/data.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller, json, model) ⇒ Data

Returns a new instance of Data.



3
4
5
6
7
8
9
10
# File 'lib/databound/data.rb', line 3

def initialize(controller, json, model)
  return unless json

  @controller = controller
  @json = json
  @data = interpolated_params
  @model = model
end

Instance Method Details

#recordsObject



12
13
14
# File 'lib/databound/data.rb', line 12

def records
  @model.where(@data)
end

#to_hObject



16
17
18
# File 'lib/databound/data.rb', line 16

def to_h
  @data || {}
end