Commit Graph

57762 Commits

Author SHA1 Message Date
yuuji.yaginuma
cfa1df4b07 update record specified in key
`#first_or_initialize` does not use attributes to data acquisition.
Therefore, there is a possibility of updating the different record than the one
specified in the key, I think this is not expected behavior.
2016-04-27 10:33:27 +09:00
Kasper Timm Hansen
e007afd3cd Merge pull request #24696 from y-yagi/remove_unnessary_option_setting
remove unnessary option setting from test runner
2016-04-25 08:07:52 +02:00
yui-knk
cd9d5c1150
Remove Array#sum method before override it
To suppress warning ('warning: method redefined; discarding old sum')
remove the method before override it.

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-24 22:05:24 -05:00
yuuji.yaginuma
996092ec18 register rake options to OptionParser
In order to prevent `OptionParser::ParseError` when specify the rake options to
`routes` task.
2016-04-25 08:33:47 +09:00
yuuji.yaginuma
9fa07095a3 remove unnessary option setting from test runner
If run the test over the `rake` command, because of the test patterns is passed
via `rake_run` method, do not need to be obtained from the argv.

This probably fixes #24372.
2016-04-25 08:33:39 +09:00
Jeremy Daer
643cac08a3
Merge pull request #23103 from rails/refactor-handling-of-action-default
Refactor handling of :action default in routing
2016-04-24 15:27:46 -07:00
Ryuta Kamizono
edc2b77187
Add Expression Indexes and Operator Classes support for PostgreSQL
Example:

    create_table :users do |t|
      t.string :name
      t.index 'lower(name) varchar_pattern_ops'
    end

Fixes #19090.
Fixes #21765.
Fixes #21819.
Fixes #24359.

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-24 14:56:29 -07:00
Seva Orlov
c41ef01aec
remove_index do not fetch indexes if name is specified
There is no need to fetch all table indexes in remove_index if name is specified. If name is wrong, then StatementInvalid will be raised.

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-24 14:32:55 -07:00
Vipul A M
6c6eeda54d
Follow up of #23461
- Rename max to statement_limit
- Remove magic number 1000 from everywhere
- Defined StatementPool::DEFAULT_STATEMENT_LIMIT and started using it everywhere

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-24 13:28:48 -07:00
Xavier Noria
7463aa19b1 rewords code comment [ci skip]
This alternative flows better.

[Richard Schneeman & Xavier Noria]
2016-04-24 21:18:21 +02:00
Xavier Noria
fe1eda64e5 removes useless use of string interpolation
`railtie` is already a string!
2016-04-24 20:17:36 +02:00
Vipul A M
35f32036b6
Include the Savepoints module in all adapters.
Adapters override `#supports_savepoints?` to return `true` if they
support transaction savepoints. Defaults to `false`.
2016-04-24 10:53:40 -07:00
Jeremy Daer
65b6496ee4
Share lock: more accurate livelock fix for aa598f4
Awaken waiting threads even if the current thread (the previously
exclusive thread) hadn't taken a share lock.

This only happens in code that wasn't run within an executor, since that
always take an outermost share lock.
2016-04-24 10:14:53 -07:00
Kasper Timm Hansen
24b1bb1a0f Merge pull request #24715 from vipulnsward/nodoc-st-pool
:nodoc: internal StatementPool class
2016-04-24 18:20:34 +02:00
Vipul A M
2fab3eee1f :nodoc: internal StatementPool class.
[ci skip]
2016-04-24 21:22:12 +05:30
Kasper Timm Hansen
8f22006c69 Merge pull request #24712 from vipulnsward/23461-release-notes
Add #23461 to release notes
2016-04-24 14:41:53 +02:00
Vipul A M
9a94f022dd Add #23461 to release notes
[ci skip]
2016-04-24 17:16:24 +05:30
Kasper Timm Hansen
e9331c646f Merge pull request #24710 from prathamesh-sonpatki/fix-build
Fix broken build, channel files are also included in `bin/rails stats` now
2016-04-24 12:15:39 +02:00
Prathamesh Sonpatki
9b0ee587af
Fix broken build, channel files are also included in bin/rails stats now
- Followup of https://github.com/rails/rails/pull/24709.
2016-04-24 14:45:55 +05:30
Jeremy Daer
91595761a8
Merge pull request #24709 from y-yagi/add_channels_files_in_stats_task
add channels files in `stats` task
2016-04-23 22:31:38 -07:00
Jeremy Daer
ab56c92f3c
Merge pull request #23461 from kamipo/prepared_statements_for_mysql2_adapter
Add prepared statements support for `Mysql2Adapter`
2016-04-23 22:28:52 -07:00
yuuji.yaginuma
ad9bdfca77 add channels files in stats task 2016-04-24 14:15:00 +09:00
Guillermo Iguaran
65d743904c Merge pull request #24701 from prathamesh-sonpatki/deprecate-request_via_redirect
Deprecate `request_via_redirect` method.
2016-04-24 00:04:26 -05:00
Jeremy Daer
7c45fa57a1
Merge pull request #24708 from kamipo/move_select_rows_implementation_to_super_class
Move `select_rows` implementation to super class
2016-04-23 21:26:33 -07:00
Guillermo Iguaran
77cd14bbbf Merge pull request #24705 from kamipo/add_nodoc_to_insert_versions_sql
Add `:nodoc:` to `insert_versions_sql` [ci skip]
2016-04-23 22:52:47 -05:00
Guillermo Iguaran
9f8a6c47c8 Merge pull request #24706 from kamipo/remove_in_doc_about_mysql_versions_below_5
Remove in the doc about MySQL versions below 5 [ci skip]
2016-04-23 22:50:26 -05:00
Guillermo Iguaran
77f3617362 Merge pull request #24707 from kamipo/move_require_ipaddr_to_oid_cidr
Move `require 'ipaddr'` in `postgresql/oid/cidr.rb`
2016-04-23 22:47:50 -05:00
Ryuta Kamizono
c1ab4a2dbf Move select_rows implementation to super class 2016-04-24 11:20:46 +09:00
Ryuta Kamizono
9c8a086863 Move require 'ipaddr' in postgresql/oid/cidr.rb
`IPAddr` is used in `OID::Cidr`.
2016-04-24 11:09:08 +09:00
Ryuta Kamizono
7ec31ac429 Remove in the doc about MySQL versions below 5 [ci skip]
Follow up to #23458.
Active Record supports MySQL >= 5.0 now.
2016-04-24 11:02:30 +09:00
Ryuta Kamizono
5394f2cde8 Add :nodoc: to insert_versions_sql [ci skip]
Follow up to #24685. `insert_versions_sql` is not public API.
2016-04-24 10:54:53 +09:00
Prathamesh Sonpatki
3da0a2b065
Deprecate request_via_redirect method.
- Followup of https://github.com/rails/rails/issues/18693.
- I think we missed deprecating `request_via_redirect` in that pull
  request.
- Originally requested by DHH here
  https://github.com/rails/rails/issues/18333.
2016-04-24 07:18:11 +05:30
प्रथमेश Sonpatki
39f1dac9a5 Merge pull request #24704 from graemeboy/master
Fix typo in ActiveJob #retry_job doc
2016-04-24 07:15:07 +05:30
Graeme Boy
6e27481dc7 Fix typo in ActiveJob #retry_job doc 2016-04-23 17:23:19 -07:00
Sean Griffin
17668cf528 Merge pull request #24703 from vipulnsward/24695-handle-nils
Followup of #15771
2016-04-23 17:27:09 -06:00
Vipul A M
210729c4cc Followup of #15771
Make sure we handle explicitly passed nil's to lock_version as well.
An explicitly passed nil value is now converted to 0 on LockingType,
so that we don't end up with ActiveRecord::StaleObjectError in update record
optimistic locking

Fixes #24695
2016-04-24 04:01:18 +05:30
Jeremy Daer
aa598f4f39
Share lock: avoid livelock due to exclusive thread sleeping before waiting threads wake 2016-04-23 15:19:25 -07:00
Andrew White
cc7bd7cc39 Merge pull request #24699 from vipulnsward/to_time_cleanup
Follow up of https://github.com/rails/rails/commit/c9c5788a527b70d7f9
2016-04-23 20:57:41 +01:00
Vipul A M
abeabdbc88 Follow up of c9c5788a52
[ci skip]
2016-04-24 01:18:15 +05:30
Andrew White
ee5e476aad Make getlocal and getutc always return instances of Time
Previously these methods could return either a DateTime or a Time
depending on how the ActiveSupport::TimeWithZone instance had
been constructed. Changing to always return an instance of Time
eliminates a possible stack level too deep error in to_time where
it was wrapping a DateTime instance.

As a consequence of this the internal time value is now always an
instance of Time in the UTC timezone, whether that's as the UTC
time directly or a representation of the local time in the timezone.

There should be no consequences of this internal change and if
there are it's a bug due to leaky abstractions.
2016-04-23 19:34:54 +01:00
Andrew White
a424bbb242 Add DateTime#subsec
Mirrors the Time#subsec method by returning the fraction
of the second as a Rational.
2016-04-23 19:18:38 +01:00
Andrew White
88d844b278 Change Time#sec_fraction to use subsec
Time instances can have fractional parts smaller than a nanosecond.
2016-04-23 19:11:34 +01:00
Andrew White
dbc7a7cb50 Add additional aliases for DateTime#utc 2016-04-23 18:01:38 +01:00
Andrew White
229737e8f3 Add CHANGELOG entry for #24700 2016-04-23 17:17:36 +01:00
Andrew White
7fb2a63708 Add Time#sec_fraction
Mirrors the DateTime#sec_fraction method by returning the fraction
of the second as a Rational.
2016-04-23 17:15:26 +01:00
Andrew White
f5dcc141ec Merge pull request #24700 from yui-knk/refactor_localtime
Move `DateTime#getlocal` to `/core_ext/date_time/calculations.rb`
2016-04-23 16:27:37 +01:00
yui-knk
941eee5c8e Move DateTime#getlocal to /core_ext/date_time/calculations.rb
`DateTime#getlocal` is newly added public API.
It's responsible is same as `DateTime#utc`, so `calculations.rb` is
a best plase to define this method.
For keeping consistency with `DateTime#utc`, defines `#localtime` and
defines `getlocal` as an alias method.
2016-04-23 23:51:49 +09:00
Andrew White
c9c5788a52 Add compatibility for Ruby 2.4 to_time changes
In Ruby 2.4 the `to_time` method for both `DateTime` and `Time` will
preserve the timezone of the receiver when converting to an instance
of `Time`. Since Rails 5.0 will support Ruby 2.2, 2.3 and later we
need to introduce a compatibility layer so that apps that upgrade do
not break. New apps will have a config initializer file that defaults
to match the new Ruby 2.4 behavior going forward.

For information about the changes to Ruby see:
https://bugs.ruby-lang.org/issues/12189
https://bugs.ruby-lang.org/issues/12271

Fixes #24617.
2016-04-23 15:03:50 +01:00
Vipul A M
1ffa1a852e Merge pull request #24697 from tomkadwill/action_pack_typos_2
Actionpack documentation typos [ci skip]
2016-04-23 19:03:28 +05:30
Tom Kadwill
51a2f7bb67 Actionpack documentation typos [ci skip] 2016-04-23 14:24:10 +01:00