Sha256: e8d25f80d092badcd02ff12349a070670cee02376983a955d2fee42ea6c8b549
Contents?: true
Size: 806 Bytes
Versions: 7
Compression:
Stored size: 806 Bytes
Contents
# frozen_string_literal: true module ActiveResource::Associations::Builder class Association #:nodoc: # providing a Class-Variable, which will have a different store of subclasses class_attribute :valid_options self.valid_options = [:class_name] # would identify subclasses of association class_attribute :macro attr_reader :model, :name, :options, :klass def self.build(model, name, options) new(model, name, options).build end def initialize(model, name, options) @model, @name, @options = model, name, options end def build validate_options model.create_reflection(self.class.macro, name, options) end private def validate_options options.assert_valid_keys(self.class.valid_options) end end end
Version data entries
7 entries across 7 versions & 2 rubygems