Skip to content

0.7.0: New config syntax, custom scopes on associations, …

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Feb 12:05
v0.7.0
0a685c5

Added

  • Options to exclude all has_many and has_one or optional belongs_to associations by default. [@Envek]

    root.exclude_has_relations
    root.exclude_optional_belongs_to

    Excluded associations can be re-included by include with matching pattern.

  • Exclusion and inclusion patterns can be specified as hashes and/or arrays. [@Envek]

    config.root('Forum', featured: true) do |forum|
      forum.include(parent: {questions: %i[answers votes]})
    end

    Which is equivalent to:

    config.root('Forum', featured: true) do |forum|
      forum.include(/\Aforum(\.parent(\.questions(\.answers))?)?)?\z/)
      forum.include(/\Aforum(\.parent(\.questions(\.votes))?)?)?\z/)
    end
  • Association limits also can be specified as hashes and/or arrays. [@Envek]

    config.root('Forum', featured: true) do |forum|
     forum.limit_associations_size(15, questions: %i[answers votes])
    end

    Which is equivalent to:

    config.root('Forum', featured: true) do |forum|
      forum.limit_associations_size(15, 'forum.questions.answers')
      forum.limit_associations_size(15, 'forum.questions.votes')
    end
  • Print reason of association exclusion or inclusion in verbose mode. [@Envek]

  • Allow to apply custom scoping to included associations. [@Envek]

    config.root('Forum', featured: true) do |forum|
      forum.include('questions.answers') do
        order(created_at: :desc)
      end
    end

Fixed

  • Error when dumping single-column tables. [@lsantobuono]
  • Bug with null foreign key to back to auxiliary has_one association with not matching names. E.g. user has many profiles and has one default profile, profile belongs to user.
  • Ignored columns handling.
  • Dump relations for records that were dumped earlier with relations excluded.