Sha256: 7a6be82cf7a32223e87b28a8ea770834620ab494a692bb54d4f7b992c8a1c96a

Contents?: true

Size: 878 Bytes

Versions: 12

Compression:

Stored size: 878 Bytes

Contents

require 'reactive_record/server_data_cache'

module ReactiveRecord

  class ReactiveRecordController < ::ApplicationController

    def fetch
      render :json => ReactiveRecord::ServerDataCache[
        (params[:models] || []).map(&:with_indifferent_access),
        (params[:associations] || []).map(&:with_indifferent_access),
        params[:pending_fetches],
        acting_user
      ]
    end


    def save
      render :json => ReactiveRecord::Base.save_records(
        (params[:models] || []).map(&:with_indifferent_access),
        (params[:associations] || []).map(&:with_indifferent_access),
        acting_user,
        params[:validate],
        true
      )
    end

    def destroy
      render :json => ReactiveRecord::Base.destroy_record(
        params[:model],
        params[:id],
        params[:vector],
        acting_user
      )
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
reactive-record-0.7.35 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.34 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.33 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.32 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.31 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.30 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.29 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.28 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.27 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.26 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.25 app/controllers/reactive_record/reactive_record_controller.rb
reactive-record-0.7.24 app/controllers/reactive_record/reactive_record_controller.rb