Skip to content
Andrew Geweke edited this page Dec 13, 2013 · 2 revisions

flex_columns can let you monitor its performance and your usage of flex_columns via ActiveSupport::Notifications. It fires two events:

  • flex_columns.deserialize: Fired when a JSON string (or compressed version thereof) is deserialized, because someone is reading or writing the data in it. The payload will contain: :model_class, bound to the ActiveRecord model class containing the flex column; :column_name, bound to a Symbol naming the flex column; :raw_data, bound to the raw data from the database; and :model, bound to the actual model instance containing the data that was deserialized. (If you're using the bulk operations API to deserialize data directly from a string, you will instead get :source => :passed_string.)
  • flex_columns.serialize: Fired when a JSON string (or compressed version thereof) is serialized, because someone has saved the model object (or called #to_stored_data or #to_json from the bulk operations API). The payload will contain: :model_class, bound to the ActiveRecord model class containing the flex column; :column_name, bound to a Symbol naming the flex column; :raw_data, bound to the raw data from the database; and :model, bound to the actual model instance containing the data that was deserialized. (If you're using the bulk operations API to deserialize data directly from a string, you will instead get :source => :passed_string.)
Clone this wiki locally