zachmokahn/searchable — pull request #11 by zachmokahn (2013-12-01 23:32:45+00:00)
Title: added ability for associations to be searchable

#####lib/searchable/is_searchable.rb
modified '#find_by_value' in the 'IsSearchable' module to accept an association in the parameters, it is defaulted to nil.
If there is an association the collection of active record associations is retrieved and the '#find_by_value' method is called on the collection.
If there is no association the '#find_by_value' is called on the model that contains the IsSearchable module from which the #find_by_value method is called. (self)

#####lib/searchable/search_helper
modified the ActiveRecord::Base class to contain a '#find_by_value' method that retrives a collection of the specified active record associations of that model and calls the #find_by_value of those objects.

#####spec/spec_helper.rb
modified schema to add two additional tables.
The 'IsNotSearchableModel' does not contain the searchable_by attribute so it is not searchable, but it has a 'has_many' association with the searchable_models
The 'IsSearchableModel' does contain the searchable_by attribute so it is searchable, and it has a 'has_many' association with the searchable model

#####spec/lib/searchable_spec.rb
added specs to test the updated '#find_by_value' in the IsSearchable module to searching of associations
added specs to test the '#find_by_value' in the ActiveRecord::Base model