Module: Hoodoo::Monkey::Patch::ActiveRecordDatedFinderAdditions::ClassExtensions
- Defined in:
- lib/hoodoo/monkey/patch/active_record_dated_finder_additions.rb
Overview
Class methods to patch over an ActiveRecord::Base subclass which includes Hoodoo::ActiveRecord::Finder and Hoodoo::ActiveRecord::Dated.
Instance Method Summary collapse
-
#acquire_in!(context) ⇒ Object
See Hoodoo::ActiveRecord::Finder::ClassMethods#acquire_in! for details.
Instance Method Details
#acquire_in!(context) ⇒ Object
See Hoodoo::ActiveRecord::Finder::ClassMethods#acquire_in! for details. Calls that method then, upon error, checks to see if a contemporary version of the resource exists and adds error generic.contemporary_exists
to the given context
if so.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hoodoo/monkey/patch/active_record_dated_finder_additions.rb', line 34 def acquire_in!( context ) result = super( context ) if result.nil? && context.request.dated_at ident = context.request.ident contemporary_result = scoped_undated_in( context ).acquire( ident ) context.response.contemporary_exists( ident ) if contemporary_result.present? end return result end |