aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | | 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.
* | | | | | | | | | Merge pull request #35132 from ↵Eileen M. Uchitelle2019-02-046-4/+56
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | eileencodes/allow-application-to-change-handler-names Add ability to change the names of the default handlers
| * | | | | | | | | Add ability to change the names of the default handlersEileen Uchitelle2019-02-016-4/+56
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I wrote the `connected_to` and `connects_to` API's I wrote them with the idea in mind that it didn't really matter what the handlers/roles were called as long as those connecting to the roles knew which one wrote and which one read. With the introduction of the middleware Rails begins to assume it's `writing` and `reading` and there's no room for other roles. At GitHub we've been using this method for a long time so we have a ton of legacy code that uses different handler names `default` and `readonly`. We could rename all our code but I think this is better for a few reasons: - Legacy apps that have been using multiple databases for a long time can have an eaiser time switching. - If we later find this to cause more issues than it's worth we can easily deprecate. - We won't force old apps to rewrite the resolver middleware just to use a different handler. Adding the writing_role/reading_role required that I move the code that creates the first handler for writing to the railtie. If I didn't move this the core class would assign the handler before I was able to assign a new one in my configuration and I'd end up with 3 handlers instead of 2.
* | | | | | | | | Merge pull request #35148 from utilum/update_template_missing_image_in_guideKasper Timm Hansen2019-02-041-0/+0
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Fix and update template_missing image in guide
| * | | | | | | | | Fix and update template_missing image in guideutilum2019-02-041-0/+0
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit updates the Missing Template image in the Getting Started Guide. The new image displays the current error message. Additionally: - New image is a PNG file, whereas the current image is in fact a misnamed JPEG. - New image is smaller. Before: ``` $ file --mime -b template_is_missing_articles_new.png image/jpeg; charset=binary $ du -h template_is_missing_articles_new.png 464K template_is_missing_articles_new.png ``` After: ``` $ file --mime -b template_is_missing_articles_new.png image/png; charset=binary $ du -h template_is_missing_articles_new.png 28K template_is_missing_articles_new.png ``` [ci-skip]
* | | | | | | | | Merge pull request #35105 from olivierlacan/document-table-foreign-keyGannon McGibbon2019-02-021-1/+2
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / / |/| | | | | | | | Hint at advanced options for foreign_key
| * | | | | | | | Hint at advanced options for foreign_keyOlivier Lacan2019-01-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We sometimes display simple examples of additional parameters that can be supplied to table-wise methods like these and I found it particularly difficult to figure out which options `t.foreign_key` accepts without drilling very deep into the specific SchemaStatements docs. Since it's relatively common to create foreign keys with custom column names or primary keys, it seems like this should help quite a few people. [ci skip]
* | | | | | | | | Merge pull request #35136 from andyw8/routes-syntaxRafael França2019-02-012-15/+15
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Use consistent hash syntax for routes
| * | | | | | | | | Use consistent hash syntax for routesAndy Waite2019-02-012-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | | | | Merge pull request #35119 from rails/file-templateAaron Patterson2019-02-0113-25/+105
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | Introduce a file type template
| * | | | | | | | | Pass source to template handler and deprecate old style handlerAaron Patterson2019-02-0110-21/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit passes the mutated source to the template handler as a parameter and deprecates the old handlers. Old handlers required that templates contain a reference to mutated source code, but we would like to make template objects "read only". This change lets the template remain "read only" while still giving template handlers access to the source code after mutations.
| * | | | | | | | | Introduce a file type template, deprecate `Template#refresh`Aaron Patterson2019-02-014-3/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every template that specifies a "virtual path" loses the template source when the template gets compiled: https://github.com/rails/rails/blob/eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c/actionview/lib/action_view/template.rb#L275 The "refresh" method seems to think that the source code for a template can be recovered if there is a virtual path: https://github.com/rails/rails/blob/eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c/actionview/lib/action_view/template.rb#L171-L188 Every call site that allocates a template object *and* provides a "virtual path" reads the template contents from the filesystem: https://github.com/rails/rails/blob/eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c/actionview/lib/action_view/template/resolver.rb#L229-L231 Templates that are inline or literals don't provide a "virtual path": https://github.com/rails/rails/blob/eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c/actionview/lib/action_view/renderer/template_renderer.rb#L34 This commit introduces a `FileTemplate` type that subclasses `Template`. The `FileTemplate` keeps a reference to the filename, and reads the source from the filesystem. This effectively makes the template source immutable. Other classes depended on the source to be mutated while being compiled, so this commit also introduces a temporary way to pass the mutated source to the ERB (or whatever) compiler. See `LegacyTemplate`. I think we should consider it an error to provide a virtual path on a non file type template an non-file templates can't recover their source. Here is an example: https://github.com/rails/rails/blob/eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c/actionview/lib/action_view/testing/resolvers.rb#L53 This provides a "virtual path" so the source code (a string literal) is thrown away after compilation. Clearly we can't recover that string, so I think this should be an error.
| * | | | | | | | | use the source returned from encode!Aaron Patterson2019-01-311-3/+5
| | | | | | | | | |
* | | | | | | | | | Merge pull request #35133 from jhawthorn/faster_notificationsAaron Patterson2019-02-011-8/+23
|\ \ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / / |/| | | | | | | | | Make Notifications::Fanout faster after changing subscriptions
| * | | | | | | | | Keep cache for strings in notifications/fanoutJohn Hawthorn2019-02-011-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding/removing a subscription with a string pattern, it isn't necessary to clear the entire cache, only the cache for the key being added. When adding/removing subscriptions for a regex or to match all events, the full cache is still cleared.
| * | | | | | | | | Make Notifications::Fanout#listeners_for fasterJohn Hawthorn2019-02-011-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we stored all subscribers in an array, and every time a new message name came in asked each subscriber if they responded to the message. This commit changes Fanout to hash subscribers with a String pattern by their pattern. This way we can look them up directly and only do the O(N) scan over the non-string (Regex or any) patterns.
* | | | | | | | | | Merge pull request #35130 from rails/move-delay-to-options-argumentEileen M. Uchitelle2019-02-014-11/+61
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Refactor options for database selector middleware
| * | | | | | | | | | Refactor options for middlewareEileen Uchitelle2019-02-014-11/+61
| | |_|_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now we only have one option that's supported, the delay. However I can see us supporting other options in the future. This PR refactors the options to get passed into the resolver so whether you're using middleware or using the config options you can pass options to the resolver. This will also make it easy to add new options in the future.
* | | | | | | | | | Merge pull request #35082 from Shopify/eagerly-materialize-test-transactionsRafael França2019-02-013-5/+8
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | Eagerly materialize the fixtures transaction
| * | | | | | | | | Eagerly materialize the fixtures transactionJean Boussier2019-01-293-5/+8
| | |_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The transaction used to restore fixtures is an implementation detail that should be abstracted away. Idealy a test should behave the same wether or not transactional fixtures are enabled. However since transactions have been made lazy, the fixture transaction started leaking into tests case. e.g. consider the following (oversimplified) test: ```ruby class SQLSubscriber attr_accessor :sql def initialize @sql = [] end def call(*, event) sql << event[:sql] end end subscriber = SQLSubscriber.new ActiveSupport::Notifications.subscribe("sql.active_record", subscriber) User.connection.execute('SELECT 1', 'Generic name') assert_equal ['SELECT 1'], subscriber.sql ``` On Rails 6 it starts to break because the `sql` array will be `['BEGIN', 'SELECT 1']`. Several things are wrong here: - That transaction is not generated by the tested code, so it shouldn't be visible. - The transaction is not even closed yet, which again doesn't reflect the reality.
* | | | | | | | | Merge pull request #35131 from alkesh26/activesupport-typo-fixesRyuta Kamizono2019-02-027-7/+7
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|_|/ |/| | | | | | | | ActiveSupport typo fixes.
| * | | | | | | | ActiveSupport typo fixes.alkesh262019-02-017-7/+7
|/ / / / / / / /
* | | | | | | | Merge pull request #35043 from simoleone/activestorage/s3/content-typeEileen M. Uchitelle2019-02-012-2/+20
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | include the content type when uploading to S3
| * | | | | | | include the content type when uploading to S3Simo Leone2019-01-242-2/+20
| | | | | | | |
* | | | | | | | Merge pull request #35126 from alkesh26/railities-typo-fixEileen M. Uchitelle2019-02-0111-14/+14
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Railties typo fixes.
| * | | | | | | | Railities typo fixes.alkesh262019-02-0111-14/+14
| | | | | | | | |
* | | | | | | | | Fix doc of `ActionDispatch::SystemTestCase` [ci skip]yuuji.yaginuma2019-02-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix broken format. * Need to specify driver to the first argument of `driven_by`. * `add_emulation` doesn't have `device` keyword. Ref: https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/chrome/options.rb#L142-L162
* | | | | | | | | Enable `Lint/ErbNewArguments` cop to avoid the deprecated arguments warningRyuta Kamizono2019-02-013-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related 5754a29a974d31cab2b4392716b9825a3d910a69. And follows Ruby standard library style https://github.com/ruby/ruby/commit/3406c5d.
* | | | | | | | | Merge pull request #35116 from kamipo/fix_through_association_creationRyuta Kamizono2019-02-014-27/+11
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Fix has_many through association creation
| * | | | | | | | | Revert "Merge pull request #33729 from kddeisz/plural-automatic-inverse"Ryuta Kamizono2019-02-012-27/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ed1eda271c7ac82ecb7bd94b6fa1b0093e648a3e, reversing changes made to 3d2caab7dc92a13d4dd369678d5b4ce659df8e52. Reason: 7c3da6e0030aa080fcb89af58b094ed50d861a44
| * | | | | | | | | Add regression test for has_many through record creationRyuta Kamizono2019-02-012-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #33729 affected the behavior of the has_many through record creation. Since #33729, the intermediate reflection of simple has_many through association has `inverse_of` to the association, it causes extra through record creation, the extra through record required valid before the association record is saved. https://github.com/rails/rails/blob/23125378673bcc606b274027666a126573e136f8/activerecord/lib/active_record/associations/has_many_through_association.rb#L95-L102 I think that #33729 need to more work to care about has_many through association, that PR should be reverted to not break existing apps.
* | | | | | | | | | Merge pull request #35117 from kamipo/remove_unused_attr_writerRyuta Kamizono2019-02-012-7/+0
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Remove unused attr_writers `visitor` and `indexes`
| * | | | | | | | | | Remove unused attr_writers `visitor` and `indexes`Ryuta Kamizono2019-02-012-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I deprecated two unused attr_writers `visitor` and `indexes` at 8056fe0 and f4bc364 conservatively, since those are accidentaly exposed in the docs. https://api.rubyonrails.org/v5.2/classes/ActiveRecord/ConnectionAdapters/AbstractAdapter.html https://api.rubyonrails.org/v5.2/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html But I've found that `view_renderer` attr_writer is removed without deprecation at #35093, that is also exposed in the doc. https://api.rubyonrails.org/v5.2/classes/ActionView/Base.html I'd like to also remove the deprecated attr_writers since I think that removing `visitor` and `indexes` attr_writers is as safe as removing `view_renderer` attr_writer.
* | | | | | | | | | | Merge pull request #31253 from knu/backquote_returns_stringYuji Yaginuma2019-02-013-14/+4
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / / / / |/| | | | | | | | | | Make the backquote operator always return a string
| * | | | | | | | | | Remove the Kernel#` override that turns ENOENT into nilAkinori MUSHA2019-01-313-14/+4
| | |/ / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport overrides `` Kernel#` `` so that it would not raise `Errno::ENOENT` but return `nil` instead (due to the last statement `STDERR.puts` returning nil) if a given command were not found. Because of this, you cannot safely say somthing like `` `command`.chomp `` when ActiveSupport is loaded. It turns out that this is an outdated monkey patch for Windows platforms to emulate Unix behavior on an ancient version of Ruby, and it should be removed by now.
* | | | | | | | | | add tests to make sure deprecated API is still supportedAaron Patterson2019-01-312-2/+14
| |/ / / / / / / / |/| | | | | | | |
* | | | | | | | | Merge pull request #35112 from alkesh26/activerecord-typo-fixesVipul A M2019-01-311-1/+1
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | ActiveRecord typo fixes. [ci skip]
| * | | | | | | | | ActiveRecord typo fixe.alkesh262019-01-311-1/+1
| |/ / / / / / / /
* | | | | | | | | Merge pull request #35115 from alkesh26/activestorage-typo-fixRyuta Kamizono2019-02-011-1/+1
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| / / / / / / / | |/ / / / / / / | | | | | | | | ActiveStorage typo fix. [ci skip]
| * / / / / / / ActiveStorage typo fix.alkesh262019-01-311-1/+1
|/ / / / / / /
* | | | | | | Merge pull request #35109 from ↵Yuji Yaginuma2019-01-311-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | abhaynikam/35073-fix-automatic-database-switching-doc-typo Fix typo: inherts -> inherits [ci skip]
| * | | | | | | Fixed typo for DatabaseSelector::Resolver documentationAbhay Nikam2019-01-311-1/+1
|/ / / / / / /
* | | | | | | Remove redundant begin blockRyuta Kamizono2019-01-311-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We enabled `Style/RedundantBegin` cop at #34764, but it is hard to detect an offence if returning value put after the block.
* | | | | | | Fix `ERB.new` argument deprecated warningyuuji.yaginuma2019-01-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes following warning. ``` warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. ```
* | | | | | | Merge pull request #35108 from jhawthorn/db-selection-timestamp-afterEileen M. Uchitelle2019-01-302-2/+43
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Write update_last_write_timestamp after request
| * | | | | | | Write update_last_write_timestamp after requestJohn Hawthorn2019-01-302-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to update using the timestamp from the end of the request, not the start. For example, if a request spends 5+ seconds writing, we still want to wait another 5 seconds for replication lag. Since we now run the update after we yield, we need to use ensure to make sure we update the timestamp even if there is an exception.
* | | | | | | | Merge pull request #35104 from alkesh26/activemodel-typo-fixesKasper Timm Hansen2019-01-302-2/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | ActiveModel typo fixes.
| * | | | | | | | activemodel typo fixes.alkesh262019-01-312-2/+2
| | |_|_|_|/ / / | |/| | | | | |
* | | | | | | | Merge pull request #34980 from y-yagi/fixes_34979Yuji Yaginuma2019-01-312-2/+10
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | Don't add `RAILS_ENV` in generate action
| * | | | | | | Don't add `RAILS_ENV` in generate actionyuuji.yaginuma2019-01-192-2/+10
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of generator, `RAILS_ENV` is interpreted as an argument as it is. Avoid this because it will result unintended by the user. Fixes #34979.