- 21 2月, 2016 6 次提交
-
-
由 Matthew Draper 提交于
Mutating the result of Relation#to_a should not affect the relation
-
由 Kasper Timm Hansen 提交于
Make collection caching explicit.
-
由 David Heinemeier Hansson 提交于
-
由 Kasper Timm Hansen 提交于
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) ```
-
由 Matthew Draper 提交于
Clarifying this separation and enforcing relation immutability is the culmination of the previous efforts to remove the mutator method delegations.
-
由 Kasper Timm Hansen 提交于
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 ca6aba7f and implement a better way later.
-
- 20 2月, 2016 13 次提交
-
-
由 Kasper Timm Hansen 提交于
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.
-
由 Eileen M. Uchitelle 提交于
fix typo
-
由 eileencodes 提交于
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 27aa4dda 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.
-
由 Lobsiinvok 提交于
-
由 प्रथमेश Sonpatki 提交于
Fixed a typo
-
由 Gautam Sawhney 提交于
-
由 Aaron Patterson 提交于
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
-
由 Rafael França 提交于
Deprecate AC::Parameters#== with Hash
-
由 Rafael França 提交于
Add methods back to array delegation from ActiveRecord::Relation
-
由 Rafael França 提交于
Fix button_to's params option to support nested names.
-
由 Kevin Dougherty 提交于
Delegation of some `Array` methods was removed in commit 9d79334a. 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 9d79334a.
-
由 Rafael França 提交于
Dependencies clean up
-
由 James Coleman 提交于
In e6e0579d 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.
-
- 19 2月, 2016 20 次提交
-
-
由 David Heinemeier Hansson 提交于
Make ActionCable logging less verbose in development
-
由 Sruli Rapps 提交于
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
-
由 Benjamin Quorning 提交于
-
由 Benjamin Quorning 提交于
Creating a protected getter method for `@parameters`.
-
由 Benjamin Quorning 提交于
-
由 Rafael França 提交于
Merge pull request #23773 from wisetara/wisetara/update-docs-ActiveSupport__TestCase#assert_nothing_raised-for-pr better docs for ActiveSupport::TestCase#assert_nothing_raised
-
-
由 Jon Moss 提交于
remove needless `debug_exception_response_format` config [ci skip]
-
由 yuuji.yaginuma 提交于
Since a0343d11, `debug_exception_response_format` config depends on `api_only`. Therefore, if set the `api_only`, need to specify `debug_exception_response_format` is not.
-
由 Sean Griffin 提交于
Remove unused require
-
由 Matthew Draper 提交于
Fix `unsubscribed` server side behavior
-
由 Xavier Noria 提交于
-
由 Jon Moss 提交于
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.
-
由 Matthew Draper 提交于
The Event hack was too much of a hack: on actually thinking about it, there's a rather obvious race.
-
由 Aaron Patterson 提交于
Fix master build
-
由 Jon Moss 提交于
-
由 Rafael Mendonça França 提交于
All gems are released now so we don't need to ask the github repository for these gems anymore.
-
由 Aaron Patterson 提交于
move digest cache on to the DetailsKey object
-
由 Rafael França 提交于
set `skip_listen` option to dummy appplication
-
由 Aaron Patterson 提交于
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.
-
- 18 2月, 2016 1 次提交
-
-
由 Aaron Patterson 提交于
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 ```
-