aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* De-dup Templates, introduce UnboundTemplateJohn Hawthorn2019-04-124-10/+82
| | | | | | | | | | | | | | | | | | | | | | Previously it's possible to have multiple copies of the "same" Template. For example, if index.html.erb is found both the :en and :fr locale, it will return a different Template object for each. The same can happen with formats, variants, and handlers. This commit de-duplicates templates, there will now only be one template per file/virtual_path/locals tuple. We need to consider virtual_path because both `render "index"`, and `render "index.html"` can both find the same file but will have different virtual_paths. IMO this is rare and should be deprecated/removed, but it exists now so we need to consider it in order to cache correctly. This commit introduces a new UnboundTemplate class, which represents a template with unknown locals. Template objects can be built from it by using `#with_locals`. Currently, this is just a convenience around caching templates, but I hope it's a helpful concept that could have more utility in the future.
* Add tests against resolverJohn Hawthorn2019-04-113-0/+109
| | | | | | | | | | | We didn't previously have many tests directly against the OptimizedFileSystemResolver or FileSystemResolver, though usually failures would be exposed through other tests. It's easier to test some specifics of the behaviour with unit tests. This also lets us test FileSystemResolver (non-optimized) which I don't think previously had much testing (other than from classses inheriting it).
* Merge pull request #35865 from jhawthorn/template_file_sourceRafael França2019-04-117-83/+46
|\ | | | | Introduce Template::Source::File, replacing FileTemplate and Template#refresh
| * Remove FileTemplateJohn Hawthorn2019-04-043-14/+3
| | | | | | | | This is unnecessary now that we can just provide a file source
| * Deprecate Template#refreshJohn Hawthorn2019-04-042-36/+4
| |
| * Add ActionView::Template::Sources::FileJohn Hawthorn2019-04-044-24/+38
| |
| * Don't call Template#refreshJohn Hawthorn2019-04-041-6/+1
| | | | | | | | | | Now that Template#source will always return a source, this is unnecessary.
| * Don't discard source after renderingJohn Hawthorn2019-04-042-5/+2
| | | | | | | | | | | | | | | | | | | | Previously, we would discard the template source after rendering, if we had a virtual path, in hopes that the virtual path would let us find our same template again going through the Resolver. Previously we discarded the source as an optimization, to avoid keeping it around in memory. By instead just reading the file every time source is called, as FileTemplate does, this is unnecessary.
* | Auto-correct `Style/RedundantBegin` cop offencesRyuta Kamizono2019-04-121-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is newly added at 7b6b10542d5dac2b50f2578143dc5d70120d1146. ``` % be rubocop -a Inspecting 2781 files ...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Offenses: activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:13: C: [Corrected] Style/RedundantBegin: Redundant begin block detected. begin ^^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:13:11: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. Rails.autoloaders.main.reload ^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. 2781 files inspected, 6 offenses detected, 6 offenses corrected ```
* | Merge pull request #35908 from soartec-lab/update_guide_engine_app_dirRafael França2019-04-111-3/+25
|\ \ | | | | | | Add all descriptions in app directory [skip ci]
| * | Add all descriptions in app directory [skip ci]soartec-lab2019-04-091-3/+25
| | |
* | | Merge pull request #35919 from Shopify/simplify-define_url_helperRafael França2019-04-111-12/+10
|\ \ \ | | | | | | | | Simplify and fasten NamedRouteCollection#define_url_helper
| * | | Simplify and fasten NamedRouteCollection#define_url_helperJean Boussier2019-04-101-12/+10
| | | |
* | | | Merge pull request #35838 from yahonda/more_than_1000_inlistRafael França2019-04-114-0/+138
|\ \ \ \ | | | | | | | | | | Address `ORA-01795: maximum number of expressions in a list is 1000`
| * | | | Address `ORA-01795: maximum number of expressions in a list is 1000`Yasuo Honda2019-04-114-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * To address this error, this commit splits expressions by slices of 1000 elements. * "Oracle Database Error Messages 18c" https://docs.oracle.com/en/database/oracle/oracle-database/18/errmg/ ``` ORA-01795: maximum number of expressions in a list is 1000 Cause: Number of expressions in the query exceeded than 1000. Note that unused column/expressions are also counted Maximum number of expressions that are allowed are 1000. ``` * This commit addresses this ORA-01795 error Note: Actually addressing this error raises another "ORA-00913: too many values" Number of values Oracle database allows is 65535 regardless bind values or literal values. ```ruby $ ARCONN=oracle bin/test test/cases/bind_parameter_test.rb -n test_too_many_binds ... snip ... Error: ActiveRecord::BindParameterTest#test_too_many_binds: ActiveRecord::StatementInvalid: OCIError: ORA-01795: maximum number of expressions in a list is 1000 stmt.c:267:in oci8lib_260.so /home/yahonda/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/ruby-oci8-2.2.7/lib/oci8/cursor.rb:131:in `exec' /home/yahonda/git/oracle-enhanced/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:142:in `exec' /home/yahonda/git/oracle-enhanced/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:41:in `block in exec_query' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:676:in `block (2 levels) in log' /home/yahonda/.rbenv/versions/2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:675:in `block in log' /home/yahonda/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:24:in `instrument' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:666:in `log' /home/yahonda/git/oracle-enhanced/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb:36:in `log' /home/yahonda/git/oracle-enhanced/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:24:in `exec_query' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:484:in `select' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:70:in `select_all' /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:106:in `select_all' /home/yahonda/git/rails/activerecord/lib/active_record/relation/calculations.rb:299:in `block in execute_simple_calculation' /home/yahonda/git/rails/activerecord/lib/active_record/relation.rb:755:in `skip_query_cache_if_necessary' /home/yahonda/git/rails/activerecord/lib/active_record/relation/calculations.rb:299:in `execute_simple_calculation' /home/yahonda/git/rails/activerecord/lib/active_record/relation/calculations.rb:251:in `perform_calculation' /home/yahonda/git/rails/activerecord/lib/active_record/relation/calculations.rb:141:in `calculate' /home/yahonda/git/rails/activerecord/lib/active_record/relation/calculations.rb:49:in `count' /home/yahonda/git/rails/activerecord/test/cases/bind_parameter_test.rb:113:in `test_too_many_binds' bin/test test/cases/bind_parameter_test.rb:109 .............................F ```
* | | | | Merge pull request #35921 from Shopify/deduplicate-activerecord-stringsRafael França2019-04-111-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Deduplicate Active Record reflection names
| * | | | | Deduplicate Active Record reflection namesJean Boussier2019-04-101-2/+2
| | |/ / / | |/| | |
* | | | | Merge pull request #35922 from ↵Rafael França2019-04-112-80/+80
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | michaelglass/move-sqlite-3-database-statements-into-database-statements make SQLite3 `last_inserted_id` private and organize DatabaseStatement methods
| * | | | | moves sqlite3 methods that mirror Abstract::DatabaseStatements into ↵Michael Glass2019-04-102-80/+80
| | | | | | | | | | | | | | | | | | | | | | | | Sqlite3::DatabaseStatements and make those that are private in Abstract::DatabaseStatements private for sqlite3
* | | | | | Merge pull request #35938 from soartec-lab/update_guide_engine_sample_codeRafael França2019-04-111-14/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | Use modele to generate generated defaults [skip ci]
| * | | | | | Use modele to generate generated defaults [skip ci]soartec-lab2019-04-111-14/+17
| | | | | | |
* | | | | | | improves the reloading disabled error messageXavier Noria2019-04-114-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original message from Zeitwerk is "can't reload, please call loader.enable_reloading before setup (Zeitwerk::Error)", which is not very informative for Rails programmers. Rails should err with a message worded in terms of its interface.
* | | | | | | Address new cop offence in railtiesRyuta Kamizono2019-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is necessary to run `rubocop` manually when new cop is added since codeclimate checks any offences only in files touched in PRs.
* | | | | | | Merge pull request #35933 from kamipo/refactor_dirty_trackingRyuta Kamizono2019-04-123-128/+122
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | PERF: 2x ~ 30x faster dirty tracking
| * | | | | | | PERF: 2x ~ 30x faster dirty trackingRyuta Kamizono2019-04-113-128/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, although using both dirty tracking (ivar backed and attributes backed) on one model is not supported (doesn't fully work at least), both dirty tracking are being performed, that is very slow. As long as attributes backed dirty tracking is used, ivar backed dirty tracking should not need to be performed. I've refactored to extract new `ForcedMutationTracker` which only tracks `force_change` to be performed for ivar backed dirty tracking, that makes dirty tracking on Active Record 2x ~ 30x faster. https://gist.github.com/kamipo/971dfe0891f0fe1ec7db8ab31f016435 Before: ``` Warming up -------------------------------------- changed? 4.467k i/100ms changed 5.134k i/100ms changes 3.023k i/100ms changed_attributes 4.358k i/100ms title_change 3.185k i/100ms title_was 3.381k i/100ms Calculating ------------------------------------- changed? 42.197k (±28.5%) i/s - 187.614k in 5.050446s changed 50.481k (±16.0%) i/s - 246.432k in 5.045759s changes 30.799k (± 7.2%) i/s - 154.173k in 5.030765s changed_attributes 51.530k (±14.2%) i/s - 252.764k in 5.041106s title_change 44.667k (± 9.0%) i/s - 222.950k in 5.040646s title_was 44.635k (±16.6%) i/s - 216.384k in 5.051098s ``` After: ``` Warming up -------------------------------------- changed? 24.130k i/100ms changed 13.503k i/100ms changes 6.511k i/100ms changed_attributes 9.226k i/100ms title_change 48.221k i/100ms title_was 96.060k i/100ms Calculating ------------------------------------- changed? 245.478k (±16.1%) i/s - 1.182M in 5.015837s changed 157.641k (± 4.9%) i/s - 796.677k in 5.066734s changes 70.633k (± 5.7%) i/s - 358.105k in 5.086553s changed_attributes 95.155k (±13.6%) i/s - 470.526k in 5.082841s title_change 566.481k (± 3.5%) i/s - 2.845M in 5.028852s title_was 1.487M (± 3.9%) i/s - 7.493M in 5.046774s ```
* | | | | | | | Merge pull request #35932 from takakuda/feature/adjust_nodoc_styleRafael França2019-04-112-17/+20
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | adjust #:nodoc: style
| * | | | | | | | Layout/SpaceBeforeComment Enabled: truekei2019-04-121-0/+3
| | | | | | | | |
| * | | | | | | | adjust styletakakuda2019-04-111-17/+17
| |/ / / / / / /
* | | | | | | | Merge pull request #35945 from soartec-lab/update_guide_engine_sample_code_blockRafael França2019-04-111-1/+3
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Code is enclosed by code block [skip ci]
| * | | | | | | | Code is enclosed by code block [skip ci]soartec-lab2019-04-121-1/+3
| | |/ / / / / / | |/| | | | | |
* | | | | | | | Merge pull request #35944 from ↵Rafael França2019-04-111-1/+1
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | soartec-lab/update_guide_engine_gem_development_dependency Updated the description of `add_development_dependency` [skip ci]
| * | | | | | | Updated the description of `add_development_dependency` [skip ci]soartec-lab2019-04-121-1/+1
|/ / / / / / /
* | | | | | | Merge pull request #35935 from y-yagi/fixes_34837George Claghorn2019-04-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix loading `ActionMailbox::BaseController` when CSRF protection is disabled
| * | | | | | | Fix loading `ActionMailbox::BaseController` when CSRF protection is disabledyuuji.yaginuma2019-04-111-1/+1
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `default_protect_from_forgery` is false, `verify_authenticity_token` callback does not define and `skip_forgery_protection` raise exception. Fixes #34837.
* | | | | | | Merge pull request #35934 from YuezhiLi/patch-1Ryuta Kamizono2019-04-111-7/+0
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | Remove outdated debugging plugins [ci skip]
| * | | | | | Remove outdated debugging pluginsClivia2019-04-111-7/+0
|/ / / / / / | | | | | | | | | | | | | | | | | | Footnote and Query review are outdated, unmaintained, and Query review is for rails 3.
* | | | | | Merge pull request #35924 from soartec-lab/update_guide_engine_generator_resultRyuta Kamizono2019-04-111-14/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | Update the result of generate command [skip ci]
| * | | | | | Update the result of generate command [skip ci]soartec-lab2019-04-111-14/+6
| | | | | | |
* | | | | | | Merge pull request #35916 from soartec-lab/delete_not_use_methodRyuta Kamizono2019-04-111-15/+0
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Delete not user method for plugin_generator
| * | | | | | Delete not user method for plugin_generatorsoartec-lab2019-04-091-15/+0
| | |_|_|/ / | |/| | | |
* | | | | | Adding type option example to the documentation [ci skip] (#35917)Roberto Miranda2019-04-101-0/+1
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Adding type option example to the documentation [ci skip] It was hard for me looking https://api.rubyonrails.org/ to find that there was a type option. Adding this to the doc would be helpful especially for application with old tables where the references are still an integer not bigint * Update activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb Co-Authored-By: robertomiranda <rjmaltamar@gmail.com>
* | | | | Revert "Remove unused callbacks in the `Topic` model"Ryuta Kamizono2019-04-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b33ccaa6c335e2ce482c9de1aa05e4a612aa84bc. That isn't hit by `git grep`, but actually used in meta-programming... https://github.com/rails/rails/blob/b33ccaa6c335e2ce482c9de1aa05e4a612aa84bc/activerecord/test/cases/transactions_test.rb#L1020-L1028
* | | | | Remove unused callbacks in the `Topic` modelRyuta Kamizono2019-04-101-4/+0
| | | | |
* | | | | Merge pull request #28155 from lcreid/belongs_toRyuta Kamizono2019-04-107-2/+72
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix "autosave: true" on belongs_to of join model causes invalid records to be saved
| * | | | | Fix circular `autosave: true`Larry Reid2018-07-237-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a variable local to the `save_collection_association` method in `activerecord/lib/active_record/autosave_association.rb`, instead of an instance variable. Prior to this PR, when there was a circular series of `autosave: true` associations, the callback for a `has_many` association was run while another instance of the same callback on the same association hadn't finished running. When control returned to the first instance of the callback, the instance variable had changed, and subsequent associated records weren't saved correctly. Specifically, the ID field for the `belongs_to` corresponding to the `has_many` was `nil`. Remove unnecessary test and comments. Fixes #28080.
* | | | | | Accidentally lost `comment` in `Column#==` and `Column#hash`Ryuta Kamizono2019-04-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Refer #35875.
* | | | | | Exclude all `node_modules` from the RuboCop checkyuuji.yaginuma2019-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | For avoiding check against `node_modules` in railties's test dir.
* | | | | | Add assertions for lazy sync transaction stateRyuta Kamizono2019-04-101-36/+49
| | | | | |
* | | | | | Remove unused `sequence_name` in `sql_for_insert`Ryuta Kamizono2019-04-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All adapters (sqlite3, mysql2, postgresql, oracle-enhanced, sqlserver) doesn't use `sequence_name` in `sql_for_insert`. https://github.com/rsim/oracle-enhanced/blob/4e0db270a93859c9713fd079dbb315b9fe550e57/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb#L79-L85 https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/959fe8f49744460b876bc205c73259f8d4f37629/lib/active_record/connection_adapters/sqlserver/database_statements.rb#L226-L249 It can be handled in `exec_insert` like postgresql adapter if we want.
* | | | | | There is no need to create `QueryAttribute` to just type cast a valueRyuta Kamizono2019-04-102-4/+2
| | | | | |