Skip to content

Avo installer: PostTypeFilter passes a record where by_post_type expects a name #64

Description

@kanejamison

Problem

On branch set-up-an-avo-installer-rake, lib/tasks/templates/avo/filters/post_type_filter.rb.tt:

post_type = PostType.find_by(name: value)
return query if post_type.nil?
query.by_post_type(post_type)

by_post_type (lib/bunko/models/post_methods.rb:36) filters by post_types: {name: type_name} — passing a record means the filter silently matches nothing.

Proposed solution

Use query.where(post_type: post_type) (or pass post_type.name).

Acceptance criteria

  • Selecting a post type in the Avo filter actually filters the index (test in test/tasks/bunko_avo_task_test.rb or an integration test).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions