简体   繁体   中英

Hobo, “Company.lost_is(false).apply_scopes”

The application I am about to develop is under migration from Hobo 1 to Hobo 1.0.3.

This is a line of code that does not work any more:

hobo_index Company.lost_is(false).apply_scopes(
  :search => [params[:search], :name],
  :order_by => parse_sort_param(:name, :last_call, :lost, :user, :country, :status, :sector), :user_is => user)

The problem here is lost_is which does not seem to return values acceptable by next routine which is: apply_scopes .

So... how can I solve this problem?

  1. Maybe make some changes to make lost_is produce values acceptable by apply_scopes
  2. Or maybe I could change params[:search] to search only for records with lost column set to false ?

Thank you!

Jacek

Adding the condition to the scopes should work:

hobo_index Company.apply_scopes(
  :lost_is => false,
  :search => [params[:search], :name],
  :order_by => parse_sort_param(:name, :last_call, :lost, :user, :country, :status, :sector),
  :user_is => user)

Regards, Ignacio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM