Module: Anubis::Core::Data::Callbacks

Included in:
Anubis::Core::DataController, Sso::Client::Data::Callbacks, Tenant::Data::Callbacks
Defined in:
app/controllers/anoubis/core/data/callbacks.rb

Overview

Module presents all callbacks called in actions.

Instance Method Summary collapse

Instance Method Details

#after_create_dataObject

Fires after data was was created on the server and placed in self.output.data array. It's rewrote for change data before output.



41
42
43
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 41

def after_create_data

end

#after_get_table_dataObject

Fires after data was received from server and placed in self.output.data array. It's rewrote for change data before output.



10
11
12
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 10

def after_get_table_data

end

#after_update_dataObject

Fires after data was was updated on the server and placed in self.output.data array. It's rewrote for change data before output.



25
26
27
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 25

def after_update_data

end

#around_output(data) ⇒ Object

Fires when data output to json value



53
54
55
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 53

def around_output(data)
  data
end

#before_create_data(data) ⇒ Hash

Fires after data was was created in self.output.data array and before it saved to server. It's rewrote for change data before output.

Parameters:

  • data (Hash)

    Data for create

Returns:

  • (Hash)

    Processed data. If returned nil then update is terminated.



34
35
36
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 34

def before_create_data(data)
  data
end

#before_outputObject

Fires right before output data to screen



47
48
49
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 47

def before_output

end

#before_update_data(data) ⇒ Hash

Fires before data will be verified and converted.

Parameters:

  • data (Hash)

    Data for update

Returns:

  • (Hash)

    Processed data. If returned nil then update is terminated.



18
19
20
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 18

def before_update_data(data)
  data
end

#destroy_dataObject

Fires when data is destroyed



59
60
61
62
63
64
# File 'app/controllers/anoubis/core/data/callbacks.rb', line 59

def destroy_data
  if !self.etc.data.data.destroy
    self.output.errors.concat self.etc.data.data.errors.full_messages
    self.output.result = -4
  end
end