Class: RailsSyncAdmin::SyncAuditsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/rails_sync_admin/sync_audits_controller.rb

Instance Method Summary collapse

Instance Method Details

#applyObject



25
26
27
28
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 25

def apply
  @sync_audit.apply_changes
  redirect_to admin_sync_audits_url, notice: 'Sync audit was successfully applied.'
end

#batchObject



17
18
19
20
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 17

def batch
  AuditApplyJob.perform_later params[:synchro_type]
  redirect_to admin_sync_audits_url, notice: 'Batch Apply Sync Run successfully in backend'
end

#destroyObject



30
31
32
33
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 30

def destroy
  @sync_audit.destroy
  redirect_to admin_sync_audits_url, notice: 'Sync audit was successfully destroyed.'
end

#indexObject



4
5
6
7
8
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 4

def index
  q_params = params.permit(:synchro_type, :state, :operation)
  @sync_audits = SyncAudit.default_where(q_params).order(id: :desc).page(params[:page])
  @synchro_types = RailsSync.synchro_types.uniq | SyncAudit.synchro_types
end

#showObject



22
23
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 22

def show
end

#syncObject



10
11
12
13
14
15
# File 'app/controllers/rails_sync_admin/sync_audits_controller.rb', line 10

def sync
  @synchro_model = params[:synchro_type].constantize
  @synchro_model.cache_all_diffs

  redirect_to admin_sync_audits_url, notice: 'Sync Run successfully '
end