Class: BookingsyncPortal::Admin::ConnectionsController

Inherits:
BaseController show all
Defined in:
app/controllers/bookingsync_portal/admin/connections_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/bookingsync_portal/admin/connections_controller.rb', line 4

def create
  if remote_account? && BookingsyncPortal.create_remote_rental
    new_remote_rental = BookingsyncPortal.remote_rental_model.constantize.new(remote_account: )
    @connection = rental.create_connection(remote_rental: new_remote_rental)
  else
    @connection = rental.create_connection(remote_rental: remote_rental)
  end

  respond_to do |wants|
    wants.html { redirect_to admin_rentals_path }
    wants.js
  end
end

#destroyObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/bookingsync_portal/admin/connections_controller.rb', line 18

def destroy
  @connection = .connections.find(params[:id]).destroy
  @not_connected_rentals = .rentals.visible.ordered.not_connected
  @visible_rentals = .rentals.visible

  respond_to do |wants|
    wants.html { redirect_to admin_rentals_path }
    wants.js
  end
end