Swiftype rails, post_url undefined method when running worker

813 Views Asked by At

I'm trying to implement Swiftype on Rails 3.2.5. However, when adding a category, and running rake jobs:work, I get the following error message:

CreateSwiftypeDocumentJob failed with NoMethodError: undefined method `post_url' for #

In the CreateSwiftypeDocumentJob model I have :

post = ProposalCategory.find(proposal_category_id) 
url = Rails.application.routes.url_helpers.post_url(post)

If somebody could please help with this, that'd be much appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

post_url should only be used if you actually have a route for the Post resource.

What is in your routes.rb file? Presumably something like:

resources :proposal_categories

In that case, you would need to use a route like proposal_category_url.