Sha256: f6969cf16afc7be31f8a19881b55591fa7e77ad09fe826d05269328a37c0599c
Contents?: true
Size: 576 Bytes
Versions: 10
Compression:
Stored size: 576 Bytes
Contents
# frozen_string_literal: true require 'lazy_record/dynamic_modules' module LazyRecord # After #initialize callbacks for validations and setting object id. module Callbacks def new(opts = {}) @all ||= Relation.new(model: self) instance = super(opts) if instance.respond_to?(:validation) instance = instance.validation(*@validations) end add_id(instance) end def add_id(instance) if instance all << instance instance.send(:id=, count) end instance end private :add_id end end
Version data entries
10 entries across 10 versions & 1 rubygems