Skip to content

problem support custom primary key #251

Closed
@masukomi

Description

@masukomi

Description
this builds on #250 BUT if we fix that issue ... we run into the next one

this line

        condition_key = meilisearch_options[:type].primary_key if has_virtual_column_as_pk

calls the primary_key method on the model. Mongoid doesn't have a primary_key method and it seem to be doing anything with the fact that I've added the following to my model. It should be calling my ms_id method but it's hardcoded to call primary_key

meilisearch primary_key: :ms_id

this may actually be an issue that extends beyond mongoid, but i can't test that at the moment.

Expected behavior
call the primary key method i told it to.

Current behavior
it called .primary_key which is a non-existent method.

Task.find('foo')
/Users/masukomi/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/meilisearch-rails-0.9.0/lib/meilisearch-rails.rb:650:in `ms_search': undefined method `primary_key' for Task:Class (NoMethodError)

        condition_key = meilisearch_options[:type].primary_key if has_virtual_column_as_pk

Environment (please complete the following information):

  • OS: [macOS]
  • Meilisearch server version: [e.g. v.1.1.1] (irrelevant though)
  • meilisearch-rails version: [e.g v0.9.0]
  • Rails version: [e.g. 7.0.4.3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions