Alex Kale


10 Experience
0 Lessons Completed
0 Questions Solved


Posted in Searchkick search_data not working

Was there any change to you code above? I'm having the same issue.

class Recipient < ActiveRecord::Base

  searchkick text_start: [:recipient_name]

  belongs_to :category

  def search_data
      recipient_name: recipient_name,
      city: city,
      state: state,
      country: country,

after running rake searchkick:reindex:all, I get the following error

Reindexing Recipient...
rake aborted!
NoMethodError: undefined method `name' for nil:NilClass
/Users/alexkale/Sites/dev/prnewswire/prn_product/app/models/recipient.rb:47:in `search_data'
Tasks: TOP => searchkick:reindex:all
(See full trace by running task with --trace)

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.