aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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.
| * | Make collection caching explicit.Kasper Timm Hansen2016-02-2010-191/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* | | Make benchmark('something', silence: true) actually workDavid Heinemeier Hansson2016-02-203-1/+19
| | |
* | | Merge pull request #23793 from qazbnm456/masterEileen M. Uchitelle2016-02-201-1/+1
|\ \ \ | | | | | | | | fix typo
| * | | fix typoLobsiinvok2016-02-201-1/+1
| | | |
* | | | Always validate record if validating a virtual attributeeileencodes2016-02-207-3/+55
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #23645 When you're using an `attr_accessor` for a record instead of an attribute in the database there's no way for the record to know if it has `changed?` unless you tell it `attribute_will_change!("attribute")`. The change made in 27aa4dd updated validations to check if a record was `changed?` or `marked_for_destruction?` or not `persisted?`. It did not take into account virtual attributes that do not affect the model's dirty status. The only way to fix this is to always validate the record if the attribute does not belong to the set of attributes the record expects (in `record.attributes`) because virtual attributes will not be in that hash. I think we should consider deprecating this particular behavior in the future and requiring that the user mark the record dirty by noting that the virtual attribute will change. Unfortunately this isn't easy because we have no way of knowing that you did the "right thing" in your application by marking it dirty and will get the deprecation warning even if you are doing the correct thing. For now this restores expected behavior when using a virtual attribute by always validating the record, as well as adds tests for this case. I was going to add the `!record.attributes.include?(attribute)` to the `should_validate?` method but `uniqueness` cannot validate a virtual attribute with nothing to hold on to the attribute. Because of this `should_validate?` was about to become a very messy method so I decided to split them up so we can handle it specifically for each case.
* | | Merge pull request #23788 from gautamsawhney/masterप्रथमेश Sonpatki2016-02-201-1/+1
|\ \ \ | | | | | | | | Fixed a typo
| * | | Fixed a typoGautam Sawhney2016-02-201-1/+1
|/ / /
* | | eliminate warnings about multiple primary keys on habtm join tablesAaron Patterson2016-02-194-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | habtm join tables commonly have two id columns and it's OK to make those two id columns a primary key. This commit eliminates the warnings for join tables that have this setup. ManageIQ/manageiq#6713
* | | Merge pull request #23733 from bquorning/actioncontroller-parameters-equalityRafael França2016-02-192-12/+59
|\ \ \ | |_|/ |/| | Deprecate AC::Parameters#== with Hash
| * | Deprecate AC::Parameters#== with a HashBenjamin Quorning2016-02-192-11/+18
| | |
| * | Fix AC::Parameters#== with other AC::ParametersBenjamin Quorning2016-02-192-3/+37
| | | | | | | | | | | | Creating a protected getter method for `@parameters`.
| * | Tests for AC::Parameters#==Benjamin Quorning2016-02-191-0/+6
| | |
* | | Merge pull request #23782 from kdough/add-array-delegation-methods-to-relationRafael França2016-02-191-1/+2
|\ \ \ | | | | | | | | Add methods back to array delegation from ActiveRecord::Relation
| * | | Add methods to array delegation from `Relation`Kevin Dougherty2016-02-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Delegation of some `Array` methods was removed in commit 9d79334. That change did add explicit delegation of a few methods that `Array` has but which aren't on `Enumerable`. However, a few non-mutation methods were omitted. This adds `Array` delegation of `#in_groups`, `#in_groups_of`, `#shuffle` and `#split`. This allows things like `MyThing.all.in_groups_of(3) { ... }` to continue working as they did before commit 9d79334.
* | | | Merge pull request #17043 from jcoleman/fix-nested-params-in-button-toRafael França2016-02-193-4/+86
|\ \ \ \ | |/ / / |/| | | Fix button_to's params option to support nested names.
| * | | Fix button_to's params option to support nested names.James Coleman2016-02-193-4/+86
| | | | | | | | | | | | | | | | | | | | | | | | In e6e0579defcfcf94ef1c4c1c7659f374a5335cdb the `params` option was added to the `button_to` helper. However, the patch doesn't support nested hashes so `{a: {b: 'c'}}` for example gets turned into a hidden form input with the name 'a' and the value being the string representation of the `{b: 'c'}` nested hash. Since Rails supports nested hashes everywhere else (and even in the URL params of link_to and button_to), I believe this to be a bug/unfinished feature.
* | | | Merge pull request #23777 from sruli/activesupport_dependencies_cleanupRafael França2016-02-192-13/+6
|\ \ \ \ | | | | | | | | | | Dependencies clean up
| * | | | Dependencies clean upSruli Rapps2016-02-192-13/+6
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleans up four items I came across in ActiveSupport::Dependencies: - DependenciesTest# test_dependency_which_raises_exception_isnt_added_to_loaded_set: Fixes current implementation which will pass no matter what since the filepath is never added to "loaded" or "history" without being expanded first. - Remove DependenciesTest#test_unhook. Seems leftover from when alias_method_chain was used in Loadable and ModuleConstMissing. The test will always pass since Module never responds to those methods - WatchStack#new_constants documentation: update self to @stack. Looks like self was leftover from when WatchStack inherited from Hash - Remove ActiveSupport namespace from call to Dependencies.constant_watch_stack.watching? since the namespace is not needed, Dependencies is called two other times in the same method without it (even on the same line) and it brings the line to within 80 characters
* | | | Merge pull request #23709 from jankeesvw/set-action-cable-logging-to-debugDavid Heinemeier Hansson2016-02-191-1/+1
|\ \ \ \ | |/ / / |/| | | Make ActionCable logging less verbose in development
| * | | Truncate ActionCable broadcast message to 300 charsJankees van Woezik2016-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When running the ActionCable server in development I get a lot of output in my logs, this commit sets a maximum length of 300 characters for a broadcast log message.
* | | | Merge pull request #23773 from ↵Rafael França2016-02-191-2/+5
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | wisetara/wisetara/update-docs-ActiveSupport__TestCase#assert_nothing_raised-for-pr better docs for ActiveSupport::TestCase#assert_nothing_raised
| * | | | better docs for ActiveSupport::TestCase#assert_nothing_raisedTara Scherner de la Fuente2016-02-181-2/+5
|/ / / /
* | | | Merge pull request #23771 from ↵Jon Moss2016-02-181-8/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | y-yagi/remove_needless_debug_exception_response_format_config remove needless `debug_exception_response_format` config [ci skip]
| * | | | remove needless `debug_exception_response_format` config [ci skip]yuuji.yaginuma2016-02-191-8/+0
|/ / / / | | | | | | | | | | | | | | | | Since a0343d11f1bf80a79e273c1d0cf9934ef2601e98, `debug_exception_response_format` config depends on `api_only`. Therefore, if set the `api_only`, need to specify `debug_exception_response_format` is not.
* | | | Merge pull request #23525 from kamipo/remove_unused_requireSean Griffin2016-02-181-1/+0
|\ \ \ \ | | | | | | | | | | Remove unused require
| * | | | Remove unused requireRyuta Kamizono2016-02-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | `require 'active_support/core_ext/benchmark'` was added by 4ecdf24. But currently unused anymore.
* | | | | Merge pull request #23715 from maclover7/fix-unsubscribeMatthew Draper2016-02-194-6/+28
|\ \ \ \ \ | | | | | | | | | | | | Fix `unsubscribed` server side behavior
| * | | | | Fix `unsubscribed` server side behaviorJon Moss2016-02-184-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the `unsubscribed` callbacks in Action Cable server side channels were never called. This is because when a WebSocket "goodbye" message was sent from the client, the Action Cable server didn't properly clean up after the now closed WebSocket. This means that memory could possibly skyrocket with this behavior, since part of this commit is to properly remove closed subscriptions from the global subscriptions hash. Say you have 10,000 users currently connected, and then all 10,000 disconnect -- before this patch, Action Cable would still hold onto information (and Ruby objects!) for all of these now dead connections.
* | | | | | partial pass over the API guide [ci skip]Xavier Noria2016-02-181-15/+14
| | | | | |
* | | | | | Use a semaphore to signal message availabilityMatthew Draper2016-02-191-7/+8
|/ / / / / | | | | | | | | | | | | | | | | | | | | The Event hack was too much of a hack: on actually thinking about it, there's a rather obvious race.
* | | | | Merge pull request #23764 from maclover7/fix-master-buildAaron Patterson2016-02-181-1/+1
|\ \ \ \ \ | |_|_|_|/ |/| | | | Fix master build
| * | | | Fix master buildJon Moss2016-02-181-1/+1
| | | | |
* | | | | Remove github gems from the master bug report templatesRafael Mendonça França2016-02-183-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | All gems are released now so we don't need to ask the github repository for these gems anymore.
* | | | | Merge pull request #23756 from tenderlove/move_digest_cacheAaron Patterson2016-02-184-14/+28
|\ \ \ \ \ | | | | | | | | | | | | move digest cache on to the DetailsKey object
| * | | | | move digest cache on to the DetailsKey objectAaron Patterson2016-02-184-14/+28
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves digest calculation cache on to the details key object. Before, the digest cache was a class level ivar, and one of the keys was the hash value of the details key object: https://github.com/rails/rails/blob/13c4cc3b5aea02716b7459c0da641438077f5236/actionview/lib/action_view/digestor.rb#L28 An object's hash value is not unique, so it's possible for this cache key to produce colliding keys with no resolution. This commit move cache on to the details key object itself, so we know that the digests are always unique per details key object.
* | | | | Merge pull request #23753 from y-yagi/skip_listen_in_dummy_appRafael França2016-02-182-0/+9
|\ \ \ \ \ | |/ / / / |/| | | | set `skip_listen` option to dummy appplication
| * | | | set `skip_listen` option to dummy appplicationyuuji.yaginuma2016-02-182-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you want to use `EventedFileUpdateChecker`, need to specify `listen` to plugin's gemspec. However, the default is not specified `listen` to plugin's gemspec, `EventedFileUpdateChecker` should be disabled.
* | | | | remove object `hash` cacheAaron Patterson2016-02-181-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't think caching this method makes any difference on Ruby 2.0: ``` require 'benchmark/ips' class Foo alias :object_hash :hash attr_reader :hash def initialize @hash = object_hash end end class Bar end hash = {} foo = Foo.new bar = Bar.new Benchmark.ips do |x| x.report("foo") { hash[foo] } x.report("bar") { hash[bar] } x.report("foo.hash") { foo.hash } x.report("bar.hash") { bar.hash } end __END__ [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 118.361k i/100ms bar 118.637k i/100ms Calculating ------------------------------------- foo 7.944M (± 3.1%) i/s - 39.769M bar 7.931M (± 3.4%) i/s - 39.625M [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 122.180k i/100ms bar 120.492k i/100ms foo.hash 123.397k i/100ms bar.hash 119.312k i/100ms Calculating ------------------------------------- foo 8.002M (± 4.2%) i/s - 39.953M bar 8.037M (± 4.5%) i/s - 40.124M foo.hash 8.819M (± 3.9%) i/s - 44.053M bar.hash 7.856M (± 4.1%) i/s - 39.254M ```
* | | | | Merge pull request #23750 from kamal-github/masterJon Moss2016-02-181-2/+2
|\ \ \ \ \ | | | | | | | | | | | | fix the language for simple and proper understanding
| * | | | | [ci skip] fix suggested change-replace 'an' with 'the in Rails engine guide'kamal namdeo2016-02-181-1/+1
| | | | | |
| * | | | | Fix the language in engines guidekamal namdeo2016-02-181-1/+1
| | | | | |
* | | | | | Merge pull request #23744 from meinac/message_verifier_docsVipul A M2016-02-181-0/+6
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Missing documentation about hash algorithm option for MessageVerifier
| * | | | | Missing documentation about hash algorithm option for MessageVerifier [ci skip]Mehmet Emin İNAÇ2016-02-181-0/+6
| | | | | |
* | | | | | Merge pull request #23747 from kamipo/add_accidentally_removed_sharpSean Griffin2016-02-171-6/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add accidentally removed `#` [ci skip]
| * | | | | | Add accidentally removed `#` [ci skip]Ryuta Kamizono2016-02-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `#` was removed at f57092a but this `#` is intentional. e.g. https://github.com/rails/rails/blame/v5.0.0.beta2/activerecord/CHANGELOG.md#L1423-L1426