Permalink
Browse files

Fix the column name [ci skip]

  • Loading branch information...
rafaelfranca committed Feb 18, 2014
1 parent 6370e69 commit 967a6dc8985ee5d9956b23ba23f0f9d39a0c07d9
Showing with 14 additions and 14 deletions.
  1. +6 −6 activerecord/CHANGELOG.md
  2. +2 −2 guides/source/active_record_querying.md
  3. +6 −6 guides/source/upgrading_ruby_on_rails.md
View
@@ -16,10 +16,10 @@
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'active'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
User.where(state: 'inactive')
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'inactive'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
After:
@@ -33,10 +33,10 @@
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
User.where(state: 'inactive')
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
To get the previous behavior it is needed to explicitly remove the
`default_scope` condition using `unscoped`, `unscope`, `rewhere` or
@@ -54,10 +54,10 @@
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'active'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
User.inactive
- # => SELECT "users".* FROM "users" WHERE "users"."status" = 'inactive'
+ # => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
* Perform necessary deeper encoding when hstore is inside an array.
@@ -1275,10 +1275,10 @@ User.all
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
User.where(state: 'inactive')
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
```
As you can see above the `default_scope` is being merged in both
@@ -283,10 +283,10 @@ User.all
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'active'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
User.where(state: 'inactive')
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'inactive'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
```
After:
@@ -302,10 +302,10 @@ User.all
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
User.where(state: 'inactive')
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
```
To get the previous behavior it is needed to explicitly remove the
@@ -323,10 +323,10 @@ User.all
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
User.active
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'active'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
User.inactive
-# => SELECT "users".* FROM "users" WHERE "users"."status" = 'inactive'
+# => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
```
Upgrading from Rails 3.2 to Rails 4.0

0 comments on commit 967a6dc

Please sign in to comment.