Module: IntegerHash::Rails::InstanceMethods
- Defined in:
- lib/integer_hash/rails.rb
Instance Method Summary collapse
-
#reload(options = nil) ⇒ Object
Override ActiveRecord::Persistence#reload passing in an options flag with { no_hashed_id: true }.
- #to_param ⇒ Object
Instance Method Details
#reload(options = nil) ⇒ Object
Override ActiveRecord::Persistence#reload passing in an options flag with { no_hashed_id: true }
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/integer_hash/rails.rb', line 41 def reload( = nil) = ( || {}).merge(no_hashed_id: true) clear_aggregation_cache clear_association_cache fresh_object = if && [:lock] self.class.unscoped { self.class.lock([:lock]).find(id, ) } else self.class.unscoped { self.class.find(id, ) } end @attributes = fresh_object.instance_variable_get('@attributes') @new_record = false self end |
#to_param ⇒ Object
35 36 37 |
# File 'lib/integer_hash/rails.rb', line 35 def to_param IntegerHash.encode(self.id).to_s end |