module SyncAttrWithAuth0::Adapters::ActiveRecord::ClassMethods
Public Instance Methods
sync_attr_with_auth0(*fields)
click to toggle source
TODO: We should accept two arrays of fields: user_metadata (for user-managed settings) and app_metadata (for app-managed settings)
# File lib/sync_attr_with_auth0/adapters/active_record.rb, line 17 def sync_attr_with_auth0(*fields) options = fields.extract_options! # Setup methods for accessing fields and options define_method 'auth0_attributes_to_sync' do fields end define_method 'setup_auth0_sync_configuration' do config = SyncAttrWithAuth0.configuration.dup options.each do |key, value| config.send(:"#{key}=", value) end config end # Setup callbacks after_validation :validate_email_with_auth0 after_create :save_to_auth0_after_create after_update :save_to_auth0_after_update after_commit :update_uid_and_picture_from_auth0 end