search - Ransack Searching Filtered Based on Two Attributes -


i using ransack , trying display records 2 different models searching.

in case vendors , users. both own campaigns.

i have tried combine 2 results 1 table using:

@search = current_user.campaigns + current_user.vendor.campaigns.where.not(:user_id =>current_user.id).search(params[:q]) 

this display table when activate ransack search part, error

no implicit conversion of ransack::search array 

is there different way me able achieve desired results using ransack?

i have tried:

 @search = campaign.search(:vendor_location_id => current_user.vendor.id) need make sure current_users campaigns show well, not vendors 

tia

solved formula:

      @search = campaign.where('(user_id ?) or (vendor_id ?)',current_user.id, current_user.vendor.id).order(:name).search(params[:q]) 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -