Sha256: a78f23d2f80b6ea5e40aa153fd253f9dd1c821448b86aa9b12ff417fdf819a74
Contents?: true
Size: 427 Bytes
Versions: 1
Compression:
Stored size: 427 Bytes
Contents
module Persisted module RecordFinder def persisted_record @persisted_record ||= existing_record end def attributes_for_finding shared_attrs = self.class.instance_variable_get '@shared_attributes' shared_attrs.each_with_object({}){ |k, a| a[k] = @params[k] } end def existing_record self.class.send(:persisted_record_class).where( attributes_for_finding ).first end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
persisted-0.0.1 | lib/persisted/record_finder.rb |