So, I found this: Searchlogic OR condition results in undefined method
But that only works for fields on the model your are searching on directly. I have a suscription model, but I want to search over the different subscriptions' account names OR their other_field, for example.
from the above link (and modified) I'd like to be able to do something similar to this:
named_scope :account_name_full_domain_like, lambda{ |name|{
:conditions => ["accounts.name LIKE ? OR accounts.full_domain LIKE ?", "%" + name + "%", "%" + name + "%"],
:joins => "LEFT JOIN `accounts` ON `accounts`.id = `subscriptions`.account_id"
}}
but now I get an error on this:
27: <% form_for @search do |f| %>
undefined method `subscription_subscription_path' for #<ActionView::Base:0x11061dbc0>
EDIT: figured it out: had to include .search in my call for assignment of the @search var
@search = Subscription.search.account_name_full_domain_like(term)