app/models/application_record.rb
# Returns an array containing the names of relations that should be serialised to JSON. By default, these are only
# `has_one` and `belongs_to` relations (ie, only those that will have a single entity, if any)
Returns an array containing the names of relations that should be serialised to JSON. By default, these are only
`has_one` and `belongs_to` relations
Returns an array containing the names of relations that should be serialised to JSON . By default these are only ` has_one ` and ` belongs_to ` relations
def serialisable_relations
    (
      self.class.reflect_on_all_associations( :has_one ) + self.class.reflect_on_all_associations( :belongs_to )
    ).map{ |r| r.name }
  end
def serialisable_relations ( self . class . reflect_on_all_associations ( :has_one ) + self . class . reflect_on_all_associations ( :belongs_to ) ) . map { | r | r . name } end
Returns an array containing the names of relations that should be serialised to JSON.
Returns an array containing the names of relations that should be serialised to JSON .