aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Generate `config/cable.yml` in `rails:update` commandJon Moss2016-02-221-0/+5
|
* Merge pull request #23816 from rails/params_parser_apiRafael França2016-02-225-9/+47
|\ | | | | Make sure the parameter parsers register API work with overidden mime types.
| * Make sure we unregister the mime type before registeringRafael Mendonça França2016-02-221-10/+22
| | | | | | | | Also make sure we don't change the global state of our test suite.
| * Transform the mime object to symbol when registering the parsersRafael Mendonça França2016-02-223-5/+15
| | | | | | | | | | This will keep our current API working without having the users to change their codebases.
| * Use symbol of mime type instead of object to get correct parserMehmet Emin İNAÇ2016-02-224-6/+22
| | | | | | | | | | | | After registering new `:json` mime type `parsers.fetch` can't find the mime type because new mime type is not equal to old one. Using symbol of the mime type as key on parsers hash solves the problem. Closes #23766
* | make sure `rake test` respects TESTOPTSAaron Patterson2016-02-222-1/+15
|/ | | | | We should be able to pass options to minitest via TESTOPTS environment variable
* We are calling `to_s` in the method so we can call downcase nowRafael Mendonça França2016-02-221-3/+3
|
* Make per form token work when method is not providedRafael Mendonça França2016-02-222-3/+18
| | | | | | When `button_to 'Botton', url` form was being used the per form token was not correct because the method that is was being used to generate it was an empty string.
* Do not pass more options that are needed.Rafael Mendonça França2016-02-221-1/+1
| | | | | We only need action and method so pass them explicitly instead of merging the hash with HTML options.
* Merge pull request #23752 from vipulnsward/23524-fix-button_to_deleteRafael Mendonça França2016-02-222-49/+61
|\ | | | | | | Fixed passing of delete method on button_to tag, creating wrong form csrf token
| * Refactored Request Forgery CSRF PerFormTokensController tests and DRY'ed ↵Vipul A M2016-02-222-71/+39
| | | | | | | | them up.
| * Fixed passing of delete method on button_to tag, creating wrong form csrf tokenVipul A M2016-02-212-2/+46
| | | | | | | | Fixes #23524
* | Merge pull request #23521 from kamipo/fix_assert_in_delta_failureRafael França2016-02-221-3/+8
|\ \ | | | | | | Fix `assert_in_delta` test failure
| * | Fix `assert_in_delta` test failureRyuta Kamizono2016-02-061-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `assert_in_delta` in `timestamp_test.rb` causes an intermittent test failure. It looks like that caused by subseconds truncation in MySQL 5.5. Example: ``` 1) Failure: TimestampTest#test_touching_many_attributes_updates_them [/home/travis/build/rails/rails/activerecord/test/cases/timestamp_test.rb:125]: Expected |2016-02-06 09:22:10 +0000 - 2016-02-06 09:22:09 UTC| (1.000837185) to be <= 1. ```
* | | Merge pull request #22748 from Azzurrio/masterMatthew Draper2016-02-222-1/+23
|\ \ \ | | | | | | | | Fix NoMethodError preparable for Arel::Visitors::PostgreSQL
| * | | Fix NoMethodError preparable for Arel::Visitors in case prepared statements ↵Azzurrio2016-02-222-1/+23
| | | | | | | | | | | | | | | | is falsy
* | | | Merge pull request #23751 from chezou/add-test-case-order-by-fieldAndrew White2016-02-221-0/+6
|\ \ \ \ | | | | | | | | | | Add test cases about MySQL ORDER BY FIELD()
| * | | | Add assertions order by field with empty dataMichiaki Ariga2016-02-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add assertions to MySQL `ORDER BY FIELD()` with empty data. These tests examine to sanitize `ORDER BY FIELD()` with empty data appropriately. ```ruby Tag.order(['field(id, ?)', []]).to_sql # => SELECT "tags".* FROM "tags" ORDER BY field(id, NULL) Tag.order(['field(id, ?)', nil]).to_sql # => SELECT "tags".* FROM "tags" ORDER BY field(id, NULL) ```
* | | | | Merge pull request #23808 from gfvcastro/typographical-errorप्रथमेश Sonpatki2016-02-221-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix typographical error
| * | | | | Fix typographical errorGustavo Villa2016-02-221-1/+1
|/ / / / /
* | | | | Merge pull request #23769 from kamipo/remove_alias_exec_without_stmt_exec_querySantiago Pastorino2016-02-211-2/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove `alias exec_without_stmt exec_query`
| * | | | | Remove `alias exec_without_stmt exec_query`Ryuta Kamizono2016-02-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This alias was for compatibility with legacy mysql adapter. But the return value of both methods is already inconsistent. `exec_query` returns `ActiveRecord::Result` instance. But `exec_without_stmt` returns `[result_set, affected_rows]` https://github.com/rails/rails/blob/v4.2.5.1/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb#L335-L364 Legacy mysql adapter was already removed in Rails 5.0. I think we can remove this inconsistent alias.
* | | | | | Merge pull request #23682 from ShikChen/fast_strxorSantiago Pastorino2016-02-211-1/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Improve the performance of string xor operation
| * | | | | | Improve the performance of string xor operationshik2016-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `each_byte` instead of `bytes` to speed up string xor operation and reduce object allocations. Inspired by commit 02c3867882d6d23b10df262a6db5f937ca69fb53. ``` ruby require 'benchmark/ips' require 'allocation_tracer' a = 32.times.map { rand(256) }.pack('C*') b = 32.times.map { rand(256) }.pack('C*') def xor_byte_strings1(s1, s2) s1.bytes.zip(s2.bytes).map { |(c1,c2)| c1 ^ c2 }.pack('c*') end def xor_byte_strings2(s1, s2) s2_bytes = s2.bytes s1.bytes.map.with_index { |c1, i| c1 ^ s2_bytes[i] }.pack('c*') end def xor_byte_strings3(s1, s2) s2_bytes = s2.bytes s1.each_byte.with_index { |c1, i| s2_bytes[i] ^= c1 } s2_bytes.pack('C*') end fail if xor_byte_strings1(a, b) != xor_byte_strings2(a, b) fail if xor_byte_strings1(a, b) != xor_byte_strings3(a, b) Benchmark.ips do |x| x.report('xor_byte_strings1') { xor_byte_strings1(a, b) } x.report('xor_byte_strings2') { xor_byte_strings2(a, b) } x.report('xor_byte_strings3') { xor_byte_strings3(a, b) } x.compare! end Tracer = ObjectSpace::AllocationTracer Tracer.setup(%i{type}) p xor_byte_strings1: Tracer.trace { xor_byte_strings1(a, b) } p xor_byte_strings2: Tracer.trace { xor_byte_strings2(a, b) } p xor_byte_strings3: Tracer.trace { xor_byte_strings3(a, b) } ``` ``` Warming up -------------------------------------- xor_byte_strings1 10.668k i/100ms xor_byte_strings2 11.814k i/100ms xor_byte_strings3 13.139k i/100ms Calculating ------------------------------------- xor_byte_strings1 116.667k (± 3.1%) i/s - 586.740k xor_byte_strings2 129.932k (± 4.3%) i/s - 649.770k xor_byte_strings3 142.506k (± 4.2%) i/s - 722.645k Comparison: xor_byte_strings3: 142506.3 i/s xor_byte_strings2: 129932.4 i/s - 1.10x slower xor_byte_strings1: 116666.8 i/s - 1.22x slower {:xor_byte_strings1=>{[:T_ARRAY]=>[38, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}} {:xor_byte_strings2=>{[:T_ARRAY]=>[3, 0, 0, 0, 0, 0], [:T_DATA]=>[1, 0, 0, 0, 0, 0], [:T_IMEMO]=>[2, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}} {:xor_byte_strings3=>{[:T_ARRAY]=>[1, 0, 0, 0, 0, 0], [:T_DATA]=>[1, 0, 0, 0, 0, 0], [:T_IMEMO]=>[2, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}} ```
* | | | | | | Merge pull request #23776 from chi6rag/masterSantiago Pastorino2016-02-211-0/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Adding test to verify the last week when the year is leap
| * | | | | | | Adding test to verify the last week when the year is leapChirag Aggarwal2016-02-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing failing specification for verifying the last week when the year is leap
* | | | | | | | Merge pull request #23803 from kamipo/reduce_attribute_to_sSantiago Pastorino2016-02-211-6/+5
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Reduce `attribute.to_s`
| * | | | | | | | Reduce `attribute.to_s`Ryuta Kamizono2016-02-221-6/+5
| | | | | | | | |
* | | | | | | | | Merge pull request #23743 from maclover7/rm-unused-parameterSantiago Pastorino2016-02-211-2/+2
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Remove unused parameter from method
| * | | | | | | | | Remove unused parameter from methodJon Moss2016-02-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `attribute` parameter is not used inside the `normalize_detail` method. This does not need to go through a deprecation cycle, since the method is private.
* | | | | | | | | | Merge pull request #23805 from ianfleeton/validates-length-of-virtualSantiago Pastorino2016-02-211-1/+1
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Match test name to test (typo)
| * | | | | | | | | | Match test name to test (typo)Ian Fleeton2016-02-211-1/+1
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #23806 from sgringwe/patch-1Santiago Pastorino2016-02-211-0/+3
|\ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | | Add a note about downcasing submit tag
| * | | | | | | | | | Add a note about downcasing submit tagScott Ringwelski2016-02-211-0/+3
|/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | This is a notable change since this will cause confusing test failures for tests relying on the old naming scheme.
* | | | | | | | | | Merge pull request #23785 from eval/correct-types-examplesVipul A M2016-02-222-108/+108
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Show correct return types for examples
| * | | | | | | | | | Show correct return types for examples [ci skip]Gert Goet2016-02-202-108/+108
| | | | | | | | | | |
* | | | | | | | | | | [ci skip] Document collection caching better.Kasper Timm Hansen2016-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why are we here? Where did we come from? Where are we going... in 5 minutes? These questions are not answered in this documentation. Instead collection caching is better clarified. How it works, how it can share caches with individual templates.
* | | | | | | | | | | [ci skip] Clarify collection caching went EXPLICIT.Kasper Timm Hansen2016-02-211-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yo dawg, we so explicit if we were a music track, yo' iPhone's Music app would put an E next to it. *drops mic*
* | | | | | | | | | | [ci skip] Mention testing fore-runners.Kasper Timm Hansen2016-02-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get it? ( ͡° ͜ʖ ͡°)
* | | | | | | | | | | Merge pull request #23799 from y-yagi/use_method_provided_by_minitestKasper Timm Hansen2016-02-211-7/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | use method provided by minitest
| * | | | | | | | | | | use method provided by minitestyuuji.yaginuma2016-02-211-7/+1
| | |_|_|_|_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The process of converting `Test` to `String` is already defined in minitest. I think it is better to use that for the consistency of output content. ref: https://github.com/seattlerb/minitest/blob/master/lib/minitest/test.rb#L261..L267
* | | | | | | | | | | Merge pull request #23801 from chashmeetsingh/patch-2प्रथमेश Sonpatki2016-02-211-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fixed typo
| * | | | | | | | | | | Fixed typoChashmeet Singh2016-02-211-1/+1
|/ / / / / / / / / / /
* | | | | | | | | | | Merge pull request #23791 from prathamesh-sonpatki/fix-changelogRafael França2016-02-201-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|_|/ / / / / / / |/| | | | | | | | | | Improve CHANGELOG for https://github.com/rails/rails/pull/17043 [ci skip]
| * | | | | | | | | | Improve CHANGELOG for https://github.com/rails/rails/pull/17043 [ci skip]Prathamesh Sonpatki2016-02-201-1/+1
| |/ / / / / / / / /
* | | | | | | | | | Merge pull request #23794 from matthewd/mutation-safe-to_aMatthew Draper2016-02-2112-24/+50
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mutating the result of Relation#to_a should not affect the relation
| * | | | | | | | | | Mutating the result of Relation#to_a should not affect the relationMatthew Draper2016-02-2111-24/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarifying this separation and enforcing relation immutability is the culmination of the previous efforts to remove the mutator method delegations.
* | | | | | | | | | | Merge pull request #23695 from kaspth/remove-automatic-collection-cachingKasper Timm Hansen2016-02-2016-252/+127
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Make collection caching explicit.
| * | | | | | | | | | | Instrument cached collection renders.Kasper Timm Hansen2016-02-205-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Augments the collection caching with some instrumentation that's logged. For collections that have been cached like: ```ruby <%= render partial: 'notifications/notification', collection: @notifications, cached: true %> ``` We'll output a line showing how many cache hits we had when rendering it: ``` Rendered collection of notifications/_notification.html.erb [0 / 100 cache hits] (3396.5ms) ```
| * | | | | | | | | | | Revert "Instrument read_multi".Kasper Timm Hansen2016-02-203-41/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reevaluating the log output generated from this instrumentation, we've found that it wasn't all that useful in practice. ``` Caches multi read: - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad ``` If rendering many templates the output is inscrutable, and it's impossible to see how many cache misses there were. Revert ca6aba7f30 and implement a better way later.