aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-315-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was almost every case where we are overriding `respond_to?` in a way that mirrors a parallel implementation of `method_missing`. There is one remaining case in Active Model that should probably do the same thing, but had a sufficiently strange implementation that I want to investigate it separately. Fixes #26333.
* | | Merge pull request #26226 from schneems/schneems/explicit-public-urlsRichard Schneeman2016-08-316-20/+199
|\ \ \ | | | | | | | | Make public asset use explicit
| * | | Fix styleschneems2016-08-302-31/+31
| | | |
| * | | Better keyword argument nameschneems2016-08-301-3/+3
| | | |
| * | | Address comment via @dhh, better option namingschneems2016-08-303-23/+23
| | | |
| * | | Explicitly mention defaults.schneems2016-08-292-2/+2
| | | |
| * | | Document public_poster_folder optionschneems2016-08-291-0/+4
| | | |
| * | | Address doc style comments from @robin850schneems2016-08-292-10/+10
| | | |
| * | | Fix asset_pipeline.md miss-mergeschneems2016-08-291-7/+7
| | | |
| * | | Specify version of Sprockets-rails this will be inschneems2016-08-291-1/+1
| | | |
| * | | Set unknown_asset_fallback false only new appsschneems2016-08-291-1/+1
| | | |
| * | | Move default to different initializerschneems2016-08-293-16/+4
| | | | | | | | | | | | | | | | | | | | Is this usage correct? cc/ @prathamesh-sonpatki
| * | | Thanks rubocopschneems2016-08-291-1/+1
| | | |
| * | | [ci skip] configuring.md assets.unknown_asset_fallbackschneems2016-08-291-0/+2
| | | |
| * | | [ci skip] asset_pipeline.md assets.unknown_asset_fallbackschneems2016-08-291-7/+20
| | | |
| * | | [ci skip] Upgrading assets.unknown_asset_fallbackschneems2016-08-291-0/+12
| | | |
| * | | Fix initializerschneems2016-08-291-1/+1
| | | |
| * | | Fully document asset_path.schneems2016-08-291-7/+58
| | | |
| * | | Do not deprecate using assets with leading slashschneems2016-08-291-10/+5
| | | |
| * | | Default assets.unknown_asset_fallback to falseschneems2016-08-291-0/+4
| | | |
| * | | Missed 2 public_* methods in cleanupschneems2016-08-291-16/+0
| | | |
| * | | Favor `public_folder: true` over `public_*`schneems2016-08-293-169/+47
| | | | | | | | | | | | | | | | Adding all those `public_*` methods is a bit heavy handed, we can change the API to instead use `public_folder: true`. Change was pretty easy since it was already implemented that way.
| * | | Fix formattingschneems2016-08-293-26/+25
| | | |
| * | | Add `public_*` helpers to all the `_tag` methods.schneems2016-08-292-19/+73
| | | |
| * | | Test `public_` methods.schneems2016-08-291-0/+72
| | | |
| * | | Match method signatureschneems2016-08-291-3/+3
| | | |
| * | | Add docs to `public_*_path` methods & fix commentsschneems2016-08-291-15/+36
| | | |
| * | | Add public URL helpersschneems2016-08-291-0/+56
| | | |
| * | | Add descriptive commentschneems2016-08-291-7/+7
| | | |
| * | | Make sure routes don't interfere with pathsschneems2016-08-291-0/+11
| | | |
| * | | Allow a more explicit public behaviorschneems2016-08-291-2/+37
| | | | | | | | | | | | | | | | | | | | We want to make it more explicit when a user wants to avoid the asset pipeline to do this we will add `public_*` methods to all path helpers. So if someone wants to use an asset that isn't maintained by the asset pipeline they can use `public_asset_path` instead of `asset_path` and letting it fall through. The main reason for this change is the desire to raise helpful errors in the future. Right now if you typo an asset name, then we assume you intended an asset in the `public/` folder and not in the pipeline so nothing fails and the error sits silently until you realize the page didn't render correctly. We have to deprecate today so we can raise meaningful error messages in the future.
* | | | Merge pull request #26283 from kamipo/use_splat_hash_for_optionsSean Griffin2016-08-311-6/+1
|\ \ \ \ | | | | | | | | | | Use splat `options` hash for `has_and_belongs_to_many`
| * | | | Use splat `options` hash for `has_and_belongs_to_many`Ryuta Kamizono2016-08-261-6/+1
| | | | | | | | | | | | | | | | | | | | For simplicity.
* | | | | Merge pull request #26282 from kamipo/add_type_default_valueSean Griffin2016-08-319-15/+13
|\ \ \ \ \ | | | | | | | | | | | | Add `Type.default_value` and use it everywhere for internal
| * | | | | Add `Type.default_value` and use it everywhere for internalRyuta Kamizono2016-08-269-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | For reduce instantiating `Type::Value`.
* | | | | | Ensure that inverse associations are set before running callbacksSean Griffin2016-08-3114-24/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a parent association was accessed in an `after_find` or `after_initialize` callback, it would always end up loading the association, and then immediately overwriting the association we just loaded. If this occurred in a way that the parent's `current_scope` was set to eager load the child, this would result in an infinite loop and eventually overflow the stack. For records that are created with `.new`, we have a mechanism to perform an action before the callbacks are run. I've introduced the same code path for records created with `instantiate`, and updated all code which sets inverse instances on newly loaded associations to use this block instead. Fixes #26320.
* | | | | | Merge pull request #26327 from mechanicles/remove-duplicationGuillermo Iguaran2016-08-301-2/+6
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Refactor remove duplication.
| * | | | | Refactor remove duplication.Santosh Wadghule2016-08-311-2/+6
| | |_|_|/ | |/| | |
* | | | | Merge pull request #26331 from kjellberg/broken-linksJon Moss2016-08-303-3/+3
|\ \ \ \ \ | | | | | | | | | | | | [ci skip] Broken links in documentation fix
| * | | | | [ci skip] Broken links in documentation fixRasmus Kjellberg2016-08-303-3/+3
| | | | | |
* | | | | | Merge pull request #23498 from jcoleman/remove-unnecessary-belongs-to-loadMatthew Draper2016-08-313-1/+14
|\ \ \ \ \ \ | | | | | | | | | | | | | | Don't unnecessarily load a belongs_to when saving.
| * | | | | | Don't unnecessarily load a belongs_to when saving.James Coleman2016-08-263-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if the the association was previously loaded and then the foreign key changed by itself, a #save call would trigger a load of the new associated record during autosave. This is unnecessary and the autosave code (in that case) didn't use the loaded record anyways.
* | | | | | | Merge pull request #26329 from riseshia/patch-1Jon Moss2016-08-301-12/+7
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Update typo & Make explanation more clear
| * | | | | | Update typo & Make explanation more clearShia2016-08-311-12/+7
|/ / / / / /
* | | | | | Merge pull request #25880 from ↵Andrew White2016-08-301-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ryandv/fix_performance_regression_in_timewithzone_to_time Fix performance regression in `TimeWithZone#to_time`
| * | | | | | Memoize coerced TimeWithZone value in TimeWithZone#localtime.Ryan De Villa2016-08-231-7/+1
| | | | | | |
| * | | | | | Fix performance regression in `TimeWithZone#to_time`Ryan De Villa2016-08-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A performance regression was introduced by commit b79adc4323ff289aed3f5787fdfbb9542aa4f89f from Rails 4.0.0.beta1, in which `TimeWithZone#to_time` no longer returns a cached instance attribute but instead coerces the value to `Time`. This coerced value is not cached, and recomputation degrades the performance of comparisons between TimeWithZone objects. See https://github.com/rails/rails/commit/b79adc4323ff289aed3f5787fdfbb9542aa4f89f#diff-3497a506c921a3a3e40fd517e92e4fe3R322 for the change in question. The following benchmark, which reverts the change linked above, demonstrates the performance regression: require 'active_support/time' require 'benchmark/ips' utc = Time.utc(2000, 1, 1, 0) time_zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] twz = ActiveSupport::TimeWithZone.new(utc, time_zone) twz2 = ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) patchedTimeWithZone = Class.new(ActiveSupport::TimeWithZone) do def to_time utc end end patched_twz = patchedTimeWithZone.new(utc, time_zone) patched_twz2 = patchedTimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) Benchmark.ips do |x| x.report("comparison out of the box") { twz <=> twz2 } x.report("comparison reverting to_time") { patched_twz <=> patched_twz2 } x.compare! end The results, when run in rails-dev-box, are as follows: Warming up -------------------------------------- comparison out of the box 24.765k i/100ms comparison reverting to_time 57.237k i/100ms Calculating ------------------------------------- comparison out of the box 517.245k (± 4.7%) i/s - 2.600M in 5.038700s comparison reverting to_time 2.624M (± 5.0%) i/s - 13.050M in 4.985808s Comparison: comparison reverting to_time: 2624266.1 i/s comparison out of the box: 517244.6 i/s - 5.07x slower The change made to run the benchmark, however, is not possible, as it would undo the intent to standardize the return value of `to_time` to `Time` in the system timezone. Our proposed solution is to restore the caching behaviour of `to_time` as it existed prior to the change linked above. Benchmark of our solution: require 'active_support/time' require 'benchmark/ips' patchedTimeWithZone = Class.new(ActiveSupport::TimeWithZone) do def to_time @to_time ||= super end end utc = Time.utc(2000, 1, 1, 0) time_zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] twz = ActiveSupport::TimeWithZone.new(utc, time_zone) twz2 = ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) patched_twz = patchedTimeWithZone.new(utc, time_zone) patched_twz2 = patchedTimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) Benchmark.ips do |x| x.report("TimeWithZone comparison - existing implementation") { twz <=> twz2 } x.report("TimeWithZone comparison - caching implementation") { patched_twz <=> patched_twz2 } x.compare! end Results in rails-dev-box: Warming up -------------------------------------- TimeWithZone comparison - existing implementation 26.629k i/100ms TimeWithZone comparison - caching implementation 59.144k i/100ms Calculating ------------------------------------- TimeWithZone comparison - existing implementation 489.757k (± 4.2%) i/s - 2.450M in 5.011639s TimeWithZone comparison - caching implementation 2.802M (± 5.3%) i/s - 13.958M in 4.996116s Comparison: TimeWithZone comparison - caching implementation: 2801519.1 i/s TimeWithZone comparison - existing implementation: 489756.7 i/s - 5.72x slower
* | | | | | | Merge pull request #26317 from maclover7/jm-fix-26298Aaron Patterson2016-08-293-8/+30
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Allow `send_file` to declare a charset
| * | | | | | Remove default argument, and extract internal convenience methodJon Moss2016-08-291-6/+12
| | | | | | |
| * | | | | | Add regression testsJon Moss2016-08-291-0/+14
| | | | | | |