123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::TokenFor

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activerecord/lib/active_record/token_for.rb

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

Instance Method Summary

DSL Calls

included

[ GitHub ]


9
10
11
12
# File 'activerecord/lib/active_record/token_for.rb', line 9

included do
  class_attribute :token_definitions, instance_accessor: false, instance_predicate: false, default: {}
  class_attribute :generated_token_verifier, instance_accessor: false, instance_predicate: false
end

Instance Method Details

#generate_token_for(purpose)

Generates a token for a predefined purpose.

Use ClassMethods#generates_token_for to define a token purpose and behavior.

[ GitHub ]

  
# File 'activerecord/lib/active_record/token_for.rb', line 119

def generate_token_for(purpose)
  self.class.token_definitions.fetch(purpose).generate_token(self)
end