binarylogic-searchlogic 2.1.11 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        data/CHANGELOG.rdoc
    CHANGED
    
    | @@ -1,3 +1,7 @@ | |
| 1 | 
            +
            == 2.1.12 released 2009-07-28
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Fixed bug when dealing with scopes that return nil.
         | 
| 4 | 
            +
             | 
| 1 5 | 
             
            == 2.1.11 released 2009-07-28
         | 
| 2 6 |  | 
| 3 7 | 
             
            * Reworked how alias conditions are created on the fly, uses scope(:find) instead of proxy_options to create the scope. This allows using association alias named scopes.
         | 
    
        data/VERSION.yml
    CHANGED
    
    
| @@ -131,7 +131,8 @@ module Searchlogic | |
| 131 131 |  | 
| 132 132 | 
             
                        eval <<-"end_eval"
         | 
| 133 133 | 
             
                          searchlogic_lambda(:#{arg_type}) { |#{proc_args.join(",")}|
         | 
| 134 | 
            -
                             | 
| 134 | 
            +
                            scope = association.klass.send(association_condition, #{proc_args.join(",")})
         | 
| 135 | 
            +
                            options = scope ? scope.scope(:find) : {}
         | 
| 135 136 | 
             
                            options.delete(:readonly)
         | 
| 136 137 | 
             
                            options[:joins] = options[:joins].blank? ? association.name : {association.name => options[:joins]}
         | 
| 137 138 | 
             
                            options
         | 
    
        data/searchlogic.gemspec
    CHANGED
    
    
| @@ -17,6 +17,10 @@ describe "Association Conditions" do | |
| 17 17 | 
             
                Company.users_username_has("bjohnson").proxy_options.should == User.username_has("bjohnson").proxy_options.merge(:joins => :users)
         | 
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 | 
            +
              it "should not raise errors for scopes that don't return anything" do
         | 
| 21 | 
            +
                Company.users_blank_scope("bjohnson").proxy_options.should == {:joins => :users}
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
              
         | 
| 20 24 | 
             
              it "should ignore polymorphic associations" do
         | 
| 21 25 | 
             
                lambda { Fee.owner_created_at_gt(Time.now) }.should raise_error(NoMethodError)
         | 
| 22 26 | 
             
              end
         | 
    
        data/spec/search_spec.rb
    CHANGED
    
    | @@ -115,6 +115,12 @@ describe "Search" do | |
| 115 115 | 
             
                  search.users_uname.should == "bjohnson"
         | 
| 116 116 | 
             
                end
         | 
| 117 117 |  | 
| 118 | 
            +
                it "should allow setting pre-existing association alias conditions" do
         | 
| 119 | 
            +
                  search = Company.search
         | 
| 120 | 
            +
                  search.users_username_has = "bjohnson"
         | 
| 121 | 
            +
                  search.users_username_has.should == "bjohnson"
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
                
         | 
| 118 124 | 
             
                it "should allow using custom conditions" do
         | 
| 119 125 | 
             
                  User.named_scope(:four_year_olds, { :conditions => { :age => 4 } })
         | 
| 120 126 | 
             
                  search = User.search
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -73,6 +73,7 @@ Spec::Runner.configure do |config| | |
| 73 73 | 
             
                  has_many :orders, :dependent => :destroy
         | 
| 74 74 | 
             
                  named_scope :uname, lambda { |value| {:conditions => ["users.username = ?", value]} }
         | 
| 75 75 | 
             
                  alias_scope :username_has, lambda { |value| username_like(value) }
         | 
| 76 | 
            +
                  alias_scope :blank_scope, lambda { |value| }
         | 
| 76 77 | 
             
                end
         | 
| 77 78 |  | 
| 78 79 | 
             
                class Order < ActiveRecord::Base
         |