Method: JSONAPI::Relationship#initialize
- Defined in:
- lib/jsonapi/relationship.rb
#initialize(name, options = {}) ⇒ Relationship
Returns a new instance of Relationship.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jsonapi/relationship.rb', line 12 def initialize(name, = {}) @name = name.to_s = @acts_as_set = .fetch(:acts_as_set, false) == true @foreign_key = [:foreign_key] ? [:foreign_key].to_sym : nil @parent_resource = [:parent_resource] @relation_name = .fetch(:relation_name, @name) @polymorphic = .fetch(:polymorphic, false) == true @polymorphic_types = [:polymorphic_types] if [:polymorphic_relations] ActiveSupport::Deprecation.warn('Use polymorphic_types instead of polymorphic_relations') @polymorphic_types ||= [:polymorphic_relations] end = if [:relation_name] false else JSONAPI.configuration. end = .fetch(:use_related_resource_records_for_joins, ) == true @always_include_optional_linkage_data = .fetch(:always_include_optional_linkage_data, false) == true @eager_load_on_include = .fetch(:eager_load_on_include, false) == true @allow_include = [:allow_include] @class_name = nil @inverse_relationship = nil @_routed = false @_warned_missing_route = false exclude_links(.fetch(:exclude_links, JSONAPI.configuration.default_exclude_links)) # Custom methods are reserved for future use @custom_methods = .fetch(:custom_methods, {}) end |