1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/relation
Carlos Antonio da Silva 8d02afeaee Rollback where.like and where.not_like
The real win with these chain methods is where.not, that takes care of
different scenarios in a graceful way, for instance when the given value
is nil.

    where("author.id != ?", author_to_ignore.id)
    where.not("author.id", author_to_ignore.id)

Both where.like and where.not_like compared to the SQL versions doesn't
seem to give us that much:

    Post.where("title LIKE 'ruby on%'")
    Post.where.like(title: 'ruby on%'")
    Post.where("title NOT LIKE 'ruby on%'")
    Post.where.not_like(title: 'ruby on%'")

Thus Rails is adding where.not, but not where.like/not_like and others.
2012-12-07 16:52:55 -02:00
..
where_chain_test.rb Rollback where.like and where.not_like 2012-12-07 16:52:55 -02:00
where_test.rb Move where with blank conditions test to the correct where tests file 2012-12-07 01:08:38 -02:00