Class: ReactiveRecord::ReactiveRecordController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ReactiveRecord::ReactiveRecordController
- Defined in:
- app/controllers/reactive_record/reactive_record_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/reactive_record/reactive_record_controller.rb', line 30 def destroy render :json => ReactiveRecord::Base.destroy_record( json_params[:model], json_params[:id], json_params[:vector], acting_user ) rescue Exception => e render json: {error: e., backtrace: e.backtrace}, status: 500 end |
#fetch ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/reactive_record/reactive_record_controller.rb', line 7 def fetch render :json => ReactiveRecord::ServerDataCache[ (json_params[:models] || []).map(&:with_indifferent_access), (json_params[:associations] || []).map(&:with_indifferent_access), json_params[:pending_fetches], acting_user ] rescue Exception => e render json: {error: e., backtrace: e.backtrace}, status: 500 end |
#save ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/reactive_record/reactive_record_controller.rb', line 18 def save render :json => ReactiveRecord::Base.save_records( (json_params[:models] || []).map(&:with_indifferent_access), (json_params[:associations] || []).map(&:with_indifferent_access), acting_user, json_params[:validate], true ) rescue Exception => e render json: {error: e., backtrace: e.backtrace}, status: 500 end |