Reputation: 1729
I've recently started seeing an odd error in my Cucumber tests. Unfortunately I can't trace back to when it was introduced.
There are a number of errors in different places along the lines of
undefined method `dir?' for #<Order:0x000000098447f8> (NoMethodError)
I don't have (and haven't had) a method anywhere in the code called 'dir?'
Any ideas what might be calling it and how to fix this one?
Update. The code fails with the same message when the page is viewed normally. The code is:
def index
search = {"meta_sort" => "id.desc"}.merge(params[:search] || {})
@search = @company.orders.search(search)
@orders = @search.paginate(:page => params[:page], :per_page => 20).includes(:premise).includes(:address)
end
Some almost identical code elsewhere works fine.
def index
@search = @company.users.shoppers.search(params[:search])
@customers = @search.paginate :page => params[:page], :per_page => 20
end
I tried changing the non-working code to mimic the working code but that didn't make any difference. The search method is provided by the metasearch gem which we've been using happily for a while now.
Update 2:
It would seem that the fault appeared with the introduction of the delayed_job and workless gems. Workless is dependent on Rush, which has a 'dir?' method. I still have no idea why the fault is cropping where it is though.
Upvotes: 1
Views: 150
Reputation: 3433
It's a name clash on the search method that is defined in Rush and use a dir? with the meta_search gem search method
Use metasearch method instead of search for searching with meta_search
Upvotes: 1