Permalink
Commits on Oct 26, 2014
  1. Improve readme.

    bigxiang committed Oct 26, 2014
  2. Fix specs to fit Rails updates.

    bigxiang committed Oct 26, 2014
Commits on Aug 4, 2014
  1. Merge pull request #328 from activerecord-hackery/order_sequence_in_r…

    …ails40
    
    Ordering sequence is now correct when chaining multiple order methods in Rails 4.0 stable branch
    bigxiang committed Aug 4, 2014
  2. Ordering sequence is now correct when chaining multiple order methods…

    … in Rails 4.0
    
    stable branch.
    
    Fixes #276.
    
    Example:
    
        Article.order {id.asc}.order {title.desc}.to_sql
        # => SELECT "articles".* FROM "articles" ORDER BY "articles".id ASC,
        #    "articles".title DESC
    bigxiang committed Aug 4, 2014
Commits on Jul 29, 2014
  1. Merge pull request #327 from activerecord-hackery/preload_error

    Fix error when when including HABTM or HMT associations without eager lo...
    bigxiang committed Jul 29, 2014
  2. Fix error when when including HABTM or HMT associations without eager…

    … loading.
    
    Fixes #326.
    
    Examples:
    
        Article.includes{tags}.to_a
        Person.includes{authored_article_comments}.to_a
    bigxiang committed Jul 29, 2014
  3. Fix NoMethodError when calling unscope method above Rails 4

    Example:
    
        class User < ActiveRecord::Base
          scope :with_activity, ->{ where{(active == true) & (posts_count +
          comments_count >= 1)} }
        end
    
        User.with_activity.unscope(where: :active)
        # => NoMethodError: undefined method `symbol' for
        #<Squeel::Nodes::Operation:0x00000018bbf798>
    estum committed with bigxiang Jul 28, 2014
Commits on Jul 25, 2014
  1. Merge pull request #323 from activerecord-hackery/default-scope-issue…

    …-rails4
    
    Properly add 'AND' to generated SQL when joining through a polymorphic model with the source type configuration and default scopes above Rails 4.
    bigxiang committed Jul 25, 2014
Commits on Jul 24, 2014
  1. Properly add 'AND' to generated SQL when joining through a polymorphi…

    …c model
    
    with the source type configuration and default scopes above Rails 4.
    
    Fixes #270.
    
    Examples:
    
        class User < ActiveRecord::Base
          has_many :memberships, as: :member
          has_many :groups, through: :memberships
          has_many :packages, through: :groups
        end
    
        class Package < ActiveRecord::Base
          has_many :memberships, as: :member
        end
    
        class Membership < ActiveRecord::Base
          belongs_to :group
          belongs_to :member, polymorphic: true
    
          default_scope -> { where(active: true) }
    
          before_create :set_active
    
          def set_active
            self.active = true
          end
        end
    
        class Group < ActiveRecord::Base
          has_many :memberships
          has_many :users, through: :memberships, source: :member, source_type: 'User'
          has_many :packages, through: :memberships, source: :member, source_type: 'Package'
        end
    
        Group.joins{users}.to_sql
        # => SELECT "groups".* FROM groups
        #    INNER JOIN "memberships" ON "groups".id = "memberships"."group_id"
        #    AND "memberships"."active" = 't'
        #    AND "memberships"."member_type" = 'User'
        #    AND "memberships"."active" = 't'
        #    INNER JOIN "users" ON "users"."id" = "memberships"."member_id"
    bigxiang committed Jul 24, 2014
Commits on Jul 22, 2014
  1. Add Xiang Li to authors

    ernie committed Jul 22, 2014
Commits on Jul 20, 2014
  1. Size method can return the result correctly when grouping by the colu…

    …mn of a joined table.
    
    Fixes #286.
    
    Examples:
    
        before:
    
        Article.joins{person}.group{person.id}.size # => Error
    
        after:
    
        Article.joins{person}.group{person.id}.size
        # => {1=>3, 2=>3, 3=>3, ...}
    bigxiang committed Jul 20, 2014
Commits on Jul 18, 2014
  1. Bump to 1.2.1

    bigxiang committed Jul 18, 2014
  2. Properly append binds from subqueries and associations with PostgreSQL.

    The issue happens if there are more than 1 bind in the SQL. Fixes #272.
    
    Generate table names correctly when joining throught an association.
    Fixes #302.
    
    add mysql, mysql2, postgresql adapter to specs. It should make sure
    that Squeel would run against all these databases consistently.
    
    Extend travis scripts to support multiple adapters.
    bigxiang committed Jul 18, 2014
Commits on Jul 16, 2014
  1. Enable using Arel nodes in Squeel with "|" operator.

    Fixes #314
    
    Examples:
    
        User.where {
          (id.in([1,2,3]) | User.arel_table[:id].eq(1)) &
          ((id == 1) | User.arel_table[:id].not_eq(nil)) }
    bigxiang committed Jul 16, 2014
  2. Add a spec to prove that ActiveRecord::Relation should be returned after

    chaining with complex associations, joins and wheres. #315
    
    Examples:
    
      Note.first.notable.articles.
        joins(:comments).where{comments.article_id != nil}.first
      # => <Article>
    bigxiang committed Jul 16, 2014
  3. Bump to 1.2.0

    bigxiang committed Jul 16, 2014
Commits on Jul 15, 2014
  1. Merge pull request #317 from bigxiang/ruby-2-rails-edge

    Make Squeel compatible with Rails 4.1 and Rails 4.2.0.alpha
    ernie committed Jul 15, 2014
  2. Add a spec to prove original AR behavior not be broken. #313

    Example:
    
        Person.joins(:articles).where(articles: { person_id: Person.first })
        Person.joins(:articles).where(articles: { person_id: Person.all.to_a })
    bigxiang committed Jul 15, 2014
  3. Squeel can bind params for CollectionProxy in subquery correctly afte…

    …r Rails 4
    
    Fix #312
    
    Examples:
    
        before:
    
        Tag.from{first_article.tags.as(Tag.table_name)}.order{tags.name}.to_a
        # => returns error or []
    
        after:
    
        Tag.from{first_article.tags.as(Tag.table_name)}.order{tags.name}.to_a
        # => [<Tag>, <Tag>, <Tag>, ...]
    bigxiang committed Jul 15, 2014
Commits on Jul 11, 2014
Commits on Jul 9, 2014
Commits on Jul 6, 2014
  1. Remove shared examples, it should be clearer to review

    what changed based on Rails versions in specs.
    - Also remove some dup methods
    bigxiang committed Jul 6, 2014
Commits on Jul 4, 2014
  1. Add compatibility to Ruby 2.0+ with Rails 4.1 and 4.2

    - Remove machinist, make model generation more robust and simplier
    - Use polyamorous master because it just compated with Rails master
    - Brand new Context class, because JoinAssociation changed a lot
    - Add 4.1 and 4.2 folders under adapters
    - Add some ! methods to visitors, so that we can throw some unexpected behaviors from them
    - Split specs into 3.x-4.0, 4.1, 4.2 folders in order to make tests easier
    - Make all specs green from Rails 3.0
    - Pend few specs because of unnecessary behaviors on Rails 4.1 & 4.2 I think
    bigxiang committed Jun 26, 2014
Commits on Jul 3, 2014
  1. fix for arel

    joseluistorres committed with radar Mar 9, 2014
Commits on Apr 11, 2014
  1. Ruby .ruby-gemset and .ruby-version files

    People should be able to use whatever gemset and ruby version they like
    radar committed Apr 11, 2014
Commits on Feb 21, 2014
  1. Merge pull request #308 from snkashis/patch-1

    update travis-ci badge on readme
    ernie committed Feb 21, 2014