Skip to content

Commit

Permalink
[#873] [#839] add "includes" automatic scope which is identical to
Browse files Browse the repository at this point in the history
"include", deprecating "include"
  • Loading branch information
bryanlarsen committed Jan 17, 2011
1 parent b46beb9 commit ee3daaa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions hobo/CHANGES.txt
Expand Up @@ -36,6 +36,10 @@ report](https://hobo.lighthouseapp.com/projects/8324/tickets/666-user-model-secu
All code changes may viewed on the [github
log](https://github.com/tablatom/hobo/compare/v1.0.2...v1.0.3)

The "include" automatic scope has been aliased to "includes" to
increase future compatibility with Rails 3. Future versions of Hobo
will remove support for "include".

=== Hobo 1.0.2 ===

This release is almost identical to 1.0.1 except that it updates the
Expand Down
6 changes: 3 additions & 3 deletions hobo/doctest/scopes.rdoctest
Expand Up @@ -288,16 +288,16 @@ Gives the N most recent items:
>> Person.order_by(:code).*.name
=> ["Bryan", "Bethany"]

## include
## includes

Adding the include function to your query chain has the same effect as
Adding the includes function to your query chain has the same effect as
the `:include` option to the `find` method.

>> Person.search("B", :name).include(:friends).*.name # test LH#839
=> ["Bryan", "Bethany"]
.hidden

>> Person.include(:friends).*.name
>> Person.includes(:friends).*.name
=> ["Bryan", "Bethany"]

## search
Expand Down
5 changes: 5 additions & 0 deletions hobo/lib/hobo/scopes/automatic_scopes.rb
Expand Up @@ -270,6 +270,11 @@ def create_scope
{ :include => inclusions }
end

when "includes"
def_scope do |inclusions|
{ :include => inclusions }
end

when "search"
def_scope do |query, *fields|
words = query.split
Expand Down

0 comments on commit ee3daaa

Please sign in to comment.