Module: Livefyre::Model::ClassMethods

Defined in:
lib/livefyre/model_extensions.rb

Instance Method Summary collapse

Instance Method Details

#livefyre_user(options = {}, &block) ⇒ Object

Public: Adds callback handlers and additional methods for treating this record as a user record.

options - [Hash] of options to initialize behavior with :update_on - [Array<Symbol>] List of fields which should trigger a Livefyre update when they’re updated. :id - [Symbol] Name of the method to use for determining this record’s livefyre ID. If not given, #id is used.

Examples

livefyre_user :update_on => [:email, :first_name, :last_name, :username, :picture_url], :id => :custom_livefyre_id

Returns [nil]



57
58
59
60
61
# File 'lib/livefyre/model_extensions.rb', line 57

def livefyre_user(options = {}, &block)
  @livefyre_options = options
  @livefyre_update_block = block
  after_save :update_livefyre_if_fields_changed
end