Commit Graph

50431 Commits

Author SHA1 Message Date
Matthew Draper
0aefa97689 Merge pull request #19442 from joevandyk/patch-1
Fix documentation for find_or_create_by
2015-03-22 13:33:54 +10:30
Sean Griffin
2271f7db17 Merge pull request #19447 from wallerjake/postgresql_big_int_array_schema_rb
Check subtype limit before using the default limit
2015-03-21 18:47:08 -06:00
wallerjake
9bc4eb7ee1 Delegate limit to subtype
As described here https://github.com/rails/rails/issues/19420. When
using the Postgres BigInt[] field type the big int value was not being
translated into schema.rb. This caused the field to become just a
regular integer field when building off of schema.rb. This fix will
address this by delegating the limit from the subtype to the Array type.

https://github.com/rails/rails/issues/19420
2015-03-21 19:32:41 -05:00
Godfrey Chan
b663e26544 Actually rename to rake initializers 2015-03-21 12:45:15 -07:00
Carlos Antonio da Silva
cdbe4fd093 Merge pull request #19443 from radanskoric/fix-am-errors-deprecation
Fix ActiveModel::Errors deprecation messages failing when used on its own
2015-03-21 15:03:36 -03:00
Carlos Antonio da Silva
9f98cf556d Rework form helper example to use Person.new
The previous change 92a3c8dcdf174dab5e8759031b6bbe6cd891fe3c improved
this example, but calling .create + #valid? ends up running validations
twice, and we don't want to showcase that.

Lets use the normal use case of building a new object and calling #save
on it, which is what a basic scaffold with Active Record does.

[ci skip]
2015-03-21 14:56:24 -03:00
Arthur Nogueira Neves
3064533076 Merge pull request #19441 from y-yagi/use_exist
use `Dir.exist?` instead of deprecated `Dir.exists?`
2015-03-21 12:24:39 -04:00
Arthur Nogueira Neves
bfd73559ec Merge pull request #19445 from prathamesh-sonpatki/rm-ostruct
Removed requiring ostruct because its unused
2015-03-21 12:16:51 -04:00
Kasper Timm Hansen
07480fb7eb Merge pull request #19444 from prathamesh-sonpatki/fix-typos
[ci skip] Fix typos in test runner's help output
2015-03-21 14:31:48 +01:00
Prathamesh Sonpatki
5b7b4e8403 Removed requiring ostruct because its unused 2015-03-21 18:49:56 +05:30
Prathamesh Sonpatki
64eb76ed16 Fix typos in test runner's help output 2015-03-21 18:25:58 +05:30
Radan Skoric
cf7fac7e29 Fix ActiveModel::Errors deprecation messages failing when used on its own
Deprecation messages in ActiveModel::Errors are using String#squish
from ActiveSupport but were not explicitly requiring it, causing failures
when used outside rails.
2015-03-21 12:35:25 +01:00
Joe Van Dyk
4364211b77 Fix documentation for find_or_create_by
The code in the comment fails on concurrent inserts if done inside a transaction. 

The fix is to force a savepoint to run so that if the database raises an unique violation exception. Otherwise, you'll get errors like:

```
   (0.3ms)  BEGIN
  Cart Load (0.5ms)  SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1

# Another process inserts a cart with uuid of '12345' right now

  SQL (4371.7ms)  INSERT INTO "carts" ("created_at", "updated_at", "uuid") VALUES ('2015-03-21 01:05:07.833231', '2015-03-21 01:05:07.833231', '12345') RETURNING "id"  [["created_at", Sat, 21 Mar 2015 01:05:07 PDT -07:00], ["updated_at", Sat, 21 Mar 2015 01:05:07 PDT -07:00], ["uuid", "12345"]]
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "carts_uuid_idx1"
DETAIL:  Key (uuid)=(12345) already exists.
: INSERT INTO "carts" ("created_at", "updated_at", "uuid") VALUES ('2015-03-21 01:05:07.833231', '2015-03-21 01:05:07.833231', '12345') RETURNING "id"

# Retrying the find

  Cart Load (0.8ms)  SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
   (0.1ms)  ROLLBACK
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
```
2015-03-21 01:16:13 -07:00
yuuji.yaginuma
a8bf335793 use Dir.exist? instead of deprecated Dir.exists? 2015-03-21 16:27:43 +09:00
Arthur Nogueira Neves
92a3c8dcdf Merge pull request #19438 from yui-knk/fix/comment
[ci skip] Check a result of `valid?` instead of `create`
2015-03-20 23:23:03 -04:00
yui-knk
cd83775858 [ci skip] Check a result of valid? instead of create 2015-03-21 09:30:48 +09:00
eileencodes
34640210ec Revert "Use def setup instead of setup do"
This reverts commit 044f9ab7a4d6646ddce4560bb83b58cdc0baa751.
2015-03-20 19:32:42 -04:00
Godfrey Chan
9e80c29cd5 rake initializer -> rake initializers
Also edited the copy to be more consistent with `rake routes`.

See #19323.
2015-03-20 15:51:01 -07:00
Rafael Mendonça França
37e002ba96 Merge pull request #19433 from agfor/fix_host_with_x_forwarded_host_header
Fix handling of empty X_FORWARDED_HOST header.
2015-03-20 18:28:21 -03:00
Rafael Mendonça França
7c7d9dcf5a Mark some constants as nodoc and remove unneeded namespace 2015-03-20 18:11:24 -03:00
Rafael Mendonça França
c35ebe17d8 Merge pull request #19413 from kirs/replace-alias_method_chain
Replace occurences of alias_method_chain with their Module#prepend counterpart
2015-03-20 18:09:16 -03:00
Kir Shatrov
d5bddc1b2d Use Module#prepend instead of alias_method_chain
Thanks @fbernier for suggestion! <3
At this moment we can use Module#prepend in all all cases
except of Range because of the bug [1] in MRI 2.2
[1] https://bugs.ruby-lang.org/issues/10847
2015-03-20 23:06:17 +02:00
Rafael Mendonça França
7815fe4634 Merge pull request #19421 from jcoyne/translate_defaults_with_nil
Strip nils out of default translations. Fixes #19419
2015-03-20 18:00:01 -03:00
adam
b49cac80de Fix handling of empty X_FORWARDED_HOST header.
Previously, an empty X_FORWARDED_HOST header would cause
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
Actiondispatch::Http:URL.host to raise a NoMethodError.
2015-03-20 20:32:30 +00:00
Rafael Mendonça França
013b716f38 Merge pull request #19432 from cllns/more-inclusive-wording
Testing Guide: Change 'girlfriend' to 'partner'
2015-03-20 16:43:57 -03:00
Sean Collins
43fc9892ac Change 'girlfriend' to 'partner' 2015-03-20 15:24:54 -04:00
Jeremy Kemper
5154089c18 Revert "Merge pull request #19404 from dmathieu/remove_rack_env"
Preserving RACK_ENV behavior.

This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing
changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
2015-03-20 08:14:11 -07:00
Jeremy Kemper
a4e7a6f9d6 Revert "Merge pull request #19411 from dmathieu/rack_env_changelog"
Preserving RACK_ENV behavior.

This reverts commit b19990c82c6a9beff0cd058dc2ff67894a2f9ea7, reversing
changes made to ac291b76ea770b5795c767f2f74a8d0b33744809.
2015-03-20 08:13:48 -07:00
eileencodes
adae55f476 Fix kwargs warning in test_get_xml
ActionDispatch::IntegrationTest HTTP request methods will accept only
certain kwargs in the future. This test caused a deprecation warning
when running ActionPack tests. Added `params` and `headers` to fix.
2015-03-20 08:48:10 -04:00
eileencodes
c757e9b60a Remove #build_original_fullpath method
Removing `#build_original_fullpath` because it is no longer
used by the Rails' source code or called in the `#call` method becasue
the previous commit now uses `fullpath` from Rack.

The method was nodoc'ed so it's safe to remove.

NOTE: I did this as a separate commit so if this does cause a problem
with engines etc reverting is easy.
2015-03-20 08:48:04 -04:00
eileencodes
0755d30017 Use fullpath from Rack request rather than building it
In Rack, `#fullpath` checks if there is a query string and builds the
query correctly:

```
def path
  script_name + path_info
end

def fullpath
  query_string.empty? ? path : "#{path}?#{query_string}"
end
```

We can utilize this instead of manually building the fullpath because
they are the same result. This also reduces allocations in `#call`
because we don't need `build_original_fullpath` to create the paths and
query strings. We don't need to build `fullpath` twice.
2015-03-20 08:48:00 -04:00
Akira Matsuda
2753ffc63e Test files should be named *_test.rb to be executed via rake task 2015-03-20 17:27:38 +09:00
Rafael Mendonça França
a1d042bea1 Merge pull request #19417 from akshay-vishnoi/test-correct
[Fix Select tag Tests] Test correct use of multiple option for select tag
2015-03-19 15:47:35 -03:00
Akshay Vishnoi
01d39787ed [Fix Select tag Tests] Test correct use of multiple option for select 2015-03-20 00:03:17 +05:30
Rafael Mendonça França
aeb0391cc1 Merge pull request #19416 from akshay-vishnoi/test-correct
Fix test messages use directly true, false and nil instead of their symbol
2015-03-19 15:19:10 -03:00
Akshay Vishnoi
c27b2df561 Fix test messages use directly true, false and nil instead of their symbol 2015-03-19 23:47:58 +05:30
Sean Griffin
1e6afa4020 Don't cast nil to string in pg enums
Fixes #19389.
2015-03-19 11:51:18 -06:00
Rafael Mendonça França
4857be1638 Merge pull request #19415 from amitsuroliya/mysql_version_update
Updated MySQL documentation link to MySQL latest version 5.6 everywhere ...
2015-03-19 13:50:27 -03:00
amitkumarsuroliya
44e94a38f4 Updated MySQL documentation link to MySQL latest version 5.6 everywhere [ci skip] 2015-03-19 22:11:18 +05:30
Sean Griffin
67dfe3f3a9 Merge pull request #19412 from amitsuroliya/mysql_adapter_doc
Updated MySQL documentation link to latest version MySQL 5.6 [ci skip]
2015-03-19 09:16:44 -06:00
Sean Griffin
505ad9af3e Merge pull request #19410 from y-yagi/add_reference_example
add foreign_key option to result of references column type [ci skip]
2015-03-19 09:16:11 -06:00
Arthur Nogueira Neves
b19990c82c Merge pull request #19411 from dmathieu/rack_env_changelog
Changelog entry for removal of RACK_ENV fallback
2015-03-19 11:07:02 -04:00
Damien Mathieu
cbadeeb969 add changelog entry for removing the fallback to rack_env
[ci skip]
2015-03-19 16:04:49 +01:00
amitkumarsuroliya
7f90d97521 Updated MySQL documentation link to latest version MySQL 5.6 [ci skip] 2015-03-19 20:34:33 +05:30
Yves Senn
ac291b76ea Merge pull request #19407 from amitsuroliya/mysql_adapter_doc
Updated MySQL documentation link for STRICT_ALL_TABLES [ci skip]
2015-03-19 16:00:41 +01:00
amitkumarsuroliya
b4e550ce46 Updated MySQL documentation link for STRICT_ALL_TABLES 2015-03-19 20:26:32 +05:30
Aaron Patterson
7bdc7635b8 Merge pull request #19404 from dmathieu/remove_rack_env
Don't fallback to RACK_ENV when RAILS_ENV is not present
2015-03-19 07:46:57 -07:00
yuuji.yaginuma
478c73f670 add foreign_key option to result of references column type [ci skip] 2015-03-19 23:19:44 +09:00
Arthur Neves
45786be516 Merge branch 'bin_test_runner'. #19216
3 commits were missing when we merged the PR, probably they were lost
when that branch was rebased against latest master.
This merge, contains those 3 commits.
2015-03-19 10:16:05 -04:00
Arthur Neves
a9eb12393f Use absolute path on find_method location for the runner 2015-03-19 10:15:03 -04:00