frozen_record icon indicating copy to clipboard operation
frozen_record copied to clipboard

Support for find with a block is missing

Open bbraschi opened this issue 1 year ago • 1 comments

FrozenRecord.Scope#find, in frozen_record/scope.rb, does not support that a block is passed to it

    def find(id)
      raise RecordNotFound, "Can't lookup record without ID" unless id

      scope = self
      if @limit || @offset
        scope = limit(nil).offset(nil)
      end
      scope.find_by_id(id) or raise RecordNotFound, "Couldn't find a record with ID = #{id.inspect}"
    end

It seems it should, as ActiveRecord.FinderMethods#find in active_record/relation/finder_methods.rb

    def find(*args)
     return super if block_given?
     find_with_ids(*args)
   end

bbraschi avatar Apr 17 '24 21:04 bbraschi

yep. PR welcome

byroot avatar Apr 17 '24 21:04 byroot