meta_search icon indicating copy to clipboard operation
meta_search copied to clipboard

Search methods for associations

Open graywh opened this issue 12 years ago • 0 comments

Given

class Parent < ActiveRecord::Base
  scope :current, lambda { where(['lifespan_start <= ?', Date.today]).where(['lifespan_end >= ?', Date.today]) }
  search_methods :current
end

class Child < ActiveRecord::Base
  belongs_to :parent
end

it would be nice to be able to

Child.search({ :parent_current => 1 })

Currently getting an undefined method `parent_current=' error.

graywh avatar Mar 02 '12 21:03 graywh