Skip to content
Snippets Groups Projects
Commit 88d87804 authored by Alex Reisner's avatar Alex Reisner
Browse files

Clean up language and spacing.

parent f1321b1e
No related branches found
No related tags found
No related merge requests found
...@@ -742,14 +742,15 @@ Known Issue ...@@ -742,14 +742,15 @@ Known Issue
You cannot use the `near` scope with another scope that provides an `includes` option because the `SELECT` clause generated by `near` will overwrite it (or vice versa). You cannot use the `near` scope with another scope that provides an `includes` option because the `SELECT` clause generated by `near` will overwrite it (or vice versa).
Instead of using `includes` to reduce the number of database queries, try using `joins` with either the `:select` option or a call to `preload`. Both choices are demonstrated below: Instead of using `includes` to reduce the number of database queries, try using `joins` with either the `:select` option or a call to `preload`. For example:
# Pass a :select option to the near scope to get the columns you want. # Pass a :select option to the near scope to get the columns you want.
# Instead of City.near(...).includes(:venues), try: # Instead of City.near(...).includes(:venues), try:
City.near("Omaha, NE", 20, :select => "cities.*, venues.*").joins(:venues) City.near("Omaha, NE", 20, :select => "cities.*, venues.*").joins(:venues)
# This preload call will normally trigger 2 queries regardless of the number of results; one query # This preload call will normally trigger two queries regardless of the
# on hotels, and one query on administrators. Instead of Hotel.near(...).includes(:administrator), try: # number of results; one query on hotels, and one query on administrators.
# Instead of Hotel.near(...).includes(:administrator), try:
Hotel.near("London, UK", 50).joins(:administrator).preload(:administrator) Hotel.near("London, UK", 50).joins(:administrator).preload(:administrator)
If anyone has a more elegant solution to this problem I am very interested in seeing it. If anyone has a more elegant solution to this problem I am very interested in seeing it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment