module ActsAsTokenizable::InstanceMethods
Public Instance Methods
to_token()
click to toggle source
default to_token
method. needs to have a “name” property on the object. override for more complex token generation
# File lib/acts_as_tokenizable/acts_as_tokenizable.rb, line 30 def to_token raise( NoMethodError, 'You must define to_token in your model. Example: self.name.to_token()' ) end
tokenize()
click to toggle source
makes self.<token_field_name>=self.to_token
# File lib/acts_as_tokenizable/acts_as_tokenizable.rb, line 38 def tokenize send("#{self.class.token_field_name}=", to_token) end
tokenize!()
click to toggle source
# File lib/acts_as_tokenizable/acts_as_tokenizable.rb, line 42 def tokenize! update_column(self.class.token_field_name, to_token) end