Module: FriendlyId::Model
- Defined in:
 - lib/friendly_id/base.rb
 
Overview
Instance methods that will be added to all classes using FriendlyId.
Instance Attribute Summary (collapse)
- 
  
    
      - (Object) current_friendly_id 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute current_friendly_id.
 
Instance Method Summary (collapse)
- 
  
    
      - (Object) friendly_id 
    
    
  
  
  
  
  
  
  
  
  
    
Get the instance's friendly_id.
 - 
  
    
      - (Object) friendly_id_config 
    
    
  
  
  
  
  
  
  
  
  
    
Convenience method for accessing the class method of the same name.
 - 
  
    
      - (Object) to_param 
    
    
  
  
  
  
  
  
  
  
  
    
Either the friendly_id, or the numeric id cast to a string.
 
Instance Attribute Details
- (Object) current_friendly_id (readonly)
Returns the value of attribute current_friendly_id
      270 271 272  | 
    
      # File 'lib/friendly_id/base.rb', line 270 def current_friendly_id @current_friendly_id end  | 
  
Instance Method Details
- (Object) friendly_id
Get the instance's friendly_id.
      278 279 280  | 
    
      # File 'lib/friendly_id/base.rb', line 278 def friendly_id send friendly_id_config.query_field end  | 
  
- (Object) friendly_id_config
Convenience method for accessing the class method of the same name.
      273 274 275  | 
    
      # File 'lib/friendly_id/base.rb', line 273 def friendly_id_config self.class.friendly_id_config end  | 
  
- (Object) to_param
Either the friendly_id, or the numeric id cast to a string.
      283 284 285 286 287 288 289  | 
    
      # File 'lib/friendly_id/base.rb', line 283 def to_param if diff = changes[friendly_id_config.query_field] diff.first || diff.second else friendly_id.presence || super end end  |