aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix deprecation warnings and call superAaron Patterson2019-02-061-2/+2
|
* Fix some typos!Aaron Patterson2019-02-062-1/+5
|
* Add a message to help allocate AV::Base instancesAaron Patterson2019-02-061-1/+5
|
* Deprecate finalizer configuration (it doesn't do anything)Aaron Patterson2019-02-064-0/+49
| | | | | | Revert "Remove finalizer and configuration" This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
* Rename method so it is more descriptiveAaron Patterson2019-02-061-3/+3
|
* Pull generated methods up in to the anonymous subclassAaron Patterson2019-02-063-19/+8
| | | | Then we don't need the extra module.
* 🚨 Make the cops happy 🚨Aaron Patterson2019-02-063-3/+3
|
* Remove finalizer and configurationAaron Patterson2019-02-065-50/+0
|
* Regenerate AV::Base subclass when DetailsKey gets clearedAaron Patterson2019-02-062-3/+29
|
* Move templates to an anonymous subclass of AV::BaseAaron Patterson2019-02-0613-35/+84
| | | | | Now we can throw away the subclass and the generated methods will get GC'd too
* Merge pull request #35171 from rails/speed-up-partialsAaron Patterson2019-02-053-19/+41
|\ | | | | Speed up partial rendering by caching "variable" calculation
| * Speed up partial rendering by caching "variable" calculationAaron Patterson2019-02-053-19/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit speeds up rendering partials by caching the variable name calculation on the template. The variable name is based on the "virtual path" used for looking up the template. The same virtual path information lives on the template, so we can just ask the cached template object for the variable. This benchmark takes a couple files, so I'll cat them below: ``` [aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat render_benchmark.rb require "benchmark/ips" require "action_view" require "action_pack" require "action_controller" class TestController < ActionController::Base end TestController.view_paths = [File.expand_path("test/benchmarks")] controller_view = TestController.new.view_context result = Benchmark.ips do |x| x.report("render") do controller_view.render("many_partials") end end [aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat test/benchmarks/test/_many_partials.html.erb Looping: <ul> <% 100.times do |i| %> <%= render partial: "list_item", locals: { i: i } %> <% end %> </ul> [aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat test/benchmarks/test/_list_item.html.erb <li>Number: <%= i %></li> ``` Benchmark results (master): ``` [aaron@TC ~/g/r/actionview (master)]$ be ruby render_benchmark.rb Warming up -------------------------------------- render 41.000 i/100ms Calculating ------------------------------------- render 424.269 (± 3.5%) i/s - 2.132k in 5.031455s ``` Benchmark results (this branch): ``` [aaron@TC ~/g/r/actionview (speed-up-partials)]$ be ruby render_benchmark.rb Warming up -------------------------------------- render 50.000 i/100ms Calculating ------------------------------------- render 521.862 (± 3.8%) i/s - 2.650k in 5.085885s ```
* | Merge pull request #35170 from palkan/fix/encrypted-fileRafael França2019-02-051-1/+2
|\ \ | | | | | | Add missing `require "tmpdir"` in ActiveSupport::EncryptedFile
| * | Add missing `require "tmpdir"` in ActiveSupport::EncryptedFileVladimir Dementyev2019-02-051-1/+2
| | |
* | | Relation no longer respond to Arel methodsRyuta Kamizono2019-02-063-19/+8
| | | | | | | | | | | | This follows up d97980a16d76ad190042b4d8578109714e9c53d0.
* | | Merge branch 'float_dom_ids'Gannon McGibbon2019-02-053-5/+27
|\ \ \ | | | | | | | | | | | | Closes #34975.
| * | | Fix unique DOM IDs for collection inputsMark Edmondson2019-01-253-5/+26
| | | |
* | | | Merge pull request #35166 from znz/improve-regexpAaron Patterson2019-02-051-1/+1
|\ \ \ \ | | | | | | | | | | Improve regexp of `html_safe_translation_key?`
| * | | | Improve regexp of `html_safe_translation_key?`Kazuhiro NISHIYAMA2019-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use `\z` instead of `$` - Use character class instead of alternation - Optimize alternation order
* | | | | Merge pull request #35169 from sponomarev/chore/specify-sqlite-in-gemfileAaron Patterson2019-02-052-1/+2
|\ \ \ \ \ | | | | | | | | | | | | Set sqlite3 gem version explicitly in generated Gemfile
| * | | | | Set sqlite3 gem version explicitly in generated GemfileSergey Ponomarev2019-02-052-1/+2
| | | | | |
* | | | | | Merge pull request #32380 from kamipo/fix_leaking_scopeRyuta Kamizono2019-02-067-8/+32
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Chaining named scope is no longer leaking to class level querying methods
| * | | | | Chaining named scope is no longer leaking to class level querying methodsRyuta Kamizono2019-02-067-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Active Record uses `scoping` to delegate to named scopes from relations for propagating the chaining source scope. It was needed to restore the source scope in named scopes, but it was caused undesired behavior that pollute all class level querying methods. Example: ```ruby class Topic < ActiveRecord::Base scope :toplevel, -> { where(parent_id: nil) } scope :children, -> { where.not(parent_id: nil) } scope :has_children, -> { where(id: Topic.children.select(:parent_id)) } end # Works as expected. Topic.toplevel.where(id: Topic.children.select(:parent_id)) # Doesn't work due to leaking `toplevel` to `Topic.children`. Topic.toplevel.has_children ``` Since #29301, the receiver in named scopes has changed from the model class to the chaining source scope, so the polluting class level querying methods is no longer required for that purpose. Fixes #14003.
* | | | | | Respect ENV variables when finding DBs etc for the test suiteMatthew Draper2019-02-0617-36/+114
|/ / / / / | | | | | | | | | | | | | | | | | | | | If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
* | | | | Merge pull request #35139 from 7coAim/fix_debug_exceptionsGeorge Claghorn2019-02-053-2/+6
|\ \ \ \ \ | |/ / / / |/| | | | Fix NameError : Make debug exceptions works in an environment where ActiveStorage is not loaded.
| * | | | fix NameErrorkurosawat2019-02-053-2/+6
| | | | | | | | | | | | | | | | | | | | NameError: uninitialized constant ActionView::CompiledTemplates::ActiveStorage
* | | | | Merge pull request #35127 from bogdan/counter-cache-loadingRyuta Kamizono2019-02-053-21/+48
|\ \ \ \ \ | | | | | | | | | | | | Bugfix association loading behavior when counter cache is zero
| * | | | | Bugfix association loading behavior when counter cache is zeroBogdan Gusiev2019-02-053-21/+48
| | | | | |
* | | | | | Use ES6 short styleDavid Heinemeier Hansson2019-02-041-3/+3
| | | | | |
* | | | | | Match rails generator outputDavid Heinemeier Hansson2019-02-041-2/+2
| | | | | |
* | | | | | Update Gemfile.lock to reflect `sqlite3` updateyuuji.yaginuma2019-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Follow up to #35154.
* | | | | | Merge pull request #35157 from sponomarev/fix/big-report-templates-sqliteRafael França2019-02-042-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Specify sqlite gem version explicitly in bug report templates
| * | | | | | Specify sqlite gem version explicitly in version-specific bug report templatesSergey Ponomarev2019-02-042-2/+2
| | | | | | |
* | | | | | | Merge pull request #35063 from rosa/current-before-reset-callbackRafael Mendonça França2019-02-043-9/+41
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | Support before_reset callback in CurrentAttributes
| * | | | | | Support before_reset callback in CurrentAttributesRosa Gutierrez2019-01-303-8/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful when we need to do some work associated to `Current.reset` but that work depends on the values of the current attributes themselves. This cannot be done in the supported `resets` callback because when the block is executed, CurrentAttributes's instance has already been reset. For symmetry, `after_reset` is defined as alias of `resets`.
* | | | | | | Merge pull request #35154 from sponomarev/chore/sqlite1.4Aaron Patterson2019-02-042-2/+2
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Relax sqlite3 version dependency
| * | | | | | Relax sqlite3 version dependencySergey Ponomarev2019-02-042-2/+2
| | |_|_|_|/ | |/| | | |
* | | | | | Take in to account optional arguments when deprecatingAaron Patterson2019-02-042-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | Refs: rails/jbuilder#452
* | | | | | Improve performance of blank? and present? in an ActiveRecord::Base instanceRafael Mendonça França2019-02-041-0/+8
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this benchmark: require "bundler/setup" require "active_record" require "benchmark/ips" # This connection will do for database-independent bug reports. ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") ActiveRecord::Schema.define do create_table :posts, force: true do |t| end end class Post < ActiveRecord::Base end new_post = Post.new Benchmark.ips do |b| b.report("present?") do new_post.present? end b.report("blank?") do new_post.blank? end end Before: Warming up -------------------------------------- present? 52.147k i/100ms blank? 53.077k i/100ms Calculating ------------------------------------- present? 580.184k (±21.8%) i/s - 2.555M in 5.427085s blank? 601.537k (± 9.2%) i/s - 2.972M in 5.003503s After: Warming up -------------------------------------- present? 378.235k i/100ms blank? 375.476k i/100ms Calculating ------------------------------------- present? 17.381M (± 7.5%) i/s - 86.238M in 5.001815s blank? 17.877M (± 6.4%) i/s - 88.988M in 5.004634s This improvement is mostly because those methods were hitting `method_missing` on a lot of levels to be able to return the value. To avoid all this stack walking we are short-circuiting those methods. Closes #35059.
* | | | | Merge pull request #35134 from Edouard-chin/ec-cookie-expiry-regressionRafael França2019-02-042-16/+4
|\ \ \ \ \ | | | | | | | | | | | | Cookie doesn't expire anymore unless a flag is set:
| * | | | | Cookie doesn't expire anymore unless a flag is set:Edouard CHIN2019-02-042-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - There is a regression in 6.0 introduced by #32937 where cookie doesn't expire anymore unless the new `use_cookies_with_metadata` configuration is set to `true`. This causes issue for app migration from 5.2 to 6.0 because the `use_cookies_with_metadata` flag can't be set to true until all servers are running on 6.0. Here is a small reproduction script that you can run in the console ```ruby ActionDispatch::Cookies request = ActionDispatch::Request.empty request.env["action_dispatch.key_generator"] = ActiveSupport::KeyGenerator.new('1234567890') request.env["action_dispatch.signed_cookie_salt"] = 'signed cookie' request.env["action_dispatch.cookies_rotations"] = ActiveSupport::Messages::RotationConfiguration.new request.env["action_dispatch.use_authenticated_cookie_encryption"] = true signed_cookie = request.cookie_jar.signed signed_cookie[:foobar] = { value: '123', expires: 1.day.ago } p signed_cookie[:foobar] ```
* | | | | | Merge pull request #35152 from ↵Vipul A M2019-02-041-0/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | scpike/guides-link-to-core-ext-string-inquiry-source Add a link to where "inquiry" is defined in ActiveSupport docs [ci skip]
| * | | | | | Add a link to where "inquiry" is defined in ActiveSupport docsStephen Pike2019-02-041-0/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | Merge pull request #35086 from gsamokovarov/cleanup-whitelisting-refsGannon McGibbon2019-02-046-10/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Cleanup the whitelisting references after #33145
| * | | | | | Cleanup the whitelisting references after #33145Genadi Samokovarov2019-02-036-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the development of #33145, I have named a few concepts in the code as `whitelisted`. We decided to stay away from the term and I adjusted most of the code afterwards, but here are the cases I forgot to change. I also found a case in the API guide that we could have cleaned up as well. [ci skip]
* | | | | | | Merge pull request #35149 from utilum/update_guide_missing_tempmlate_textEileen M. Uchitelle2019-02-041-13/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Update template missing text in Guide
| * | | | | | | Update template missing text in Guideutilum2019-02-041-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the Getting Started guide explanation for `ActionController::MissingExactTemplate` error, to reflect the current message. Follow up for #29286, #35148 [ci skip]
* | | | | | | | Allow configuring the Azure Storage service with extra client optionsgarytaylor2019-02-041-2/+2
| | | | | | | |
* | | | | | | | Merge pull request #35089 from ↵Eileen M. Uchitelle2019-02-043-1/+48
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eileencodes/fix-query-cache-for-database-switching Invalidate all query caches for current thread
| * | | | | | | | Invalidate query cache for all connections in the current threadEileen Uchitelle2019-02-013-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change ensures that all query cahces are cleared across all connections per handler for the current thread so if you write on one connection the read will have the query cache cleared.