Module: Databound

Defined in:
lib/databound.rb,
lib/databound/data.rb,
lib/databound/config.rb,
lib/databound/manager.rb,
lib/databound/railtie.rb,
lib/databound/version.rb,
lib/databound/controller.rb,
lib/databound/initializer.rb,
lib/generators/databound/install/install_generator.rb

Defined Under Namespace

Modules: Generators, Initializer Classes: Config, ConfigError, Controller, Data, Manager, NotPermittedError, Railtie

Constant Summary collapse

VERSION =
'3.1.3'

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
# File 'lib/databound.rb', line 21

def create
  record = @crud.create_from_data

  render json: {
    success: true,
    id: serialize(record, :id),
    scoped_records: serialize_array(scoped_records),
  }
end

#destroyObject



41
42
43
44
45
46
47
48
# File 'lib/databound.rb', line 41

def destroy
  @crud.destroy_from_data

  render json: {
    success: true,
    scoped_records: serialize_array(scoped_records),
  }
end

#updateObject



31
32
33
34
35
36
37
38
39
# File 'lib/databound.rb', line 31

def update
  record = @crud.update_from_data

  render json: {
    success: true,
    id: serialize(record, :id),
    scoped_records: serialize_array(scoped_records),
  }
end

#whereObject



12
13
14
15
16
17
18
19
# File 'lib/databound.rb', line 12

def where
  records = @crud.find_scoped_records

  render json: {
    success: true,
    records: serialize_array(records),
  }
end