picky

https://github.com/floere/picky

HTML

Picky is an easy to use and fast Ruby semantic search engine that helps your users find what they are looking for.

Picky::Convenience#populate_with

Populates the ids with (rendered) model instances.

It does this by calling #find_by_id on the given model class.

Give it eg. an ActiveRecord class and options for the find_by_id and it
will yield each found result for you to render.

If you don't pass it a block, it will just use the AR results.

Note: Usually, after this the ids are not needed anymore.
      Use #clear_ids to remove them.

=== Parameters
* model_class: The model to use for the results. Will call #find on the given class.

=== Options
* up_to: Amount of results to populate. All of them by default.
* finder_method: Specify which AR finder method you want to load the model with. Default is #find_all_by_id.
* The rest of the options are directly passed through to the ModelClass.find_by_id(ids, options) method. Default is {}.

Source | Google | Stack overflow

Edit

git clone [email protected]:floere/picky.git

cd picky

open client/lib/picky-client/convenience.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Picky--Convenience-populate_with-for-pr


# Commit to git

git add client/lib/picky-client/convenience.rbgit commit -m "better docs for Picky::Convenience#populate_with"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Picky--Convenience-populate_with-for-pr

hub pull-request


# Celebrate!