aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #32271 from eileencodes/fix-three-tier-default-connectionEileen M. Uchitelle2018-03-164-2/+53
|\ | | | | Fix default connection handling with three-tier config
| * Switch dbconsole config loader checkeileencodes2018-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In a three-tier config environment `configurations[environment].presence` will return `{ :primary => { :key => value, :key => value }, :secondary => { :key => value, :key => value} }, which means it's not given a single config to connect to. If we flip these however it will connect to primary because that's the default connection, and on a two tier it will be `nil` so the code will select the connection from the configurations rather than the connection.
| * Fix connection handling with three-tier configeileencodes2018-03-163-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you had a three-tier config, the `establish_connection` that's called in the Railtie on load can't figure out how to access the default configuration. This is because Rails assumes that the config is the first value in the hash and always associated with the key from the environment. With a three tier config however we need to go one level deeper. This commit includes 2 changes. 1) removes a line from `resolve_all` which was parsing out the the environment from the config so instead of getting ``` { :development => { :primary => { :database => "whatever" } }, :animals => { :database => "whatever-animals" } }, etc with test / prod } ``` We'd instead end up with a config that had no attachment to it's envioronment. ``` { :primary => { :database => "whatever" } :animals => { :database => "whatever-animals" } etc - without test and prod } ``` Not only did this mean that Active Record didn't know how to establish a connection, it didn't have the other necessary configs along with it in the configs list. So fix this I removed the line that deletes these configs. The second thing this commit changes is adding this line to `establish_connection` ``` spec = spec[spec_name.to_sym] if spec[spec_name.to_sym] ``` When you have a three-tier config and don't pass any hash/symbol/env etc to `establish_connection` the resolver will automatically return both the primary and secondary (in this case animals db) configurations. We'll get an `database configuration does not specify adapter` error because AR will try to establish a connection on the `primary` key rather than the `primary` key's config. It assumes that the `development` or default env automatically will return a config hash, but with a three-tier config we actually get a key and config `primary => config`. This fix is a bit of a bandaid because it's not the "correct" way to handle this situation, but it does solve our immediate problem. The new code here is saying "if the config returned from the resolver (I know it's called spec in here but we interchange our meanings a LOT and what is returned is a three-tier config) has a key matching the "primary" spec name, grab the config from the spec and pass that to the estalbish_connection method". This works because if we pass `:animals` or a hash, or `:primary` we'll already have the correct configuration to connect with. This fixes the case where we want Rail to connect with the default connection. Coming soon is a refactoring that should eliminate the need to do this but I need this fix in order to write the multi-db rake tasks that I promised in my RailsConf submission. `@tenderlove` and I are working on the refactoring of the internals for connection management but it won't be ready for a few weeks and this issue has been blocking progress.
* | :scissors:Rafael Mendonça França2018-03-161-1/+0
| | | | | | | | [ci skip]
* | Fix multiline expression indexes for postgresql (#31621)fatkodima2018-03-163-3/+3
| |
* | Don't need to include in the changelog something that was release in 5.2Rafael Mendonça França2018-03-151-4/+0
| | | | | | | | [ci skip]
* | Check exclude before flagging cookies as secure in ActionDispatch::SSL (#32262)Catherine Khuu2018-03-153-1/+15
| | | | | | | | | | | | | | * Check exclude before flagging cookies as secure. * Update comments in ActionDispatch::SSL. [Catherine Khuu + Rafael Mendonça França]
* | Merge pull request #31250 from ↵Kasper Timm Hansen2018-03-156-9/+101
|\ \ | | | | | | | | | | | | lsylvester/only-preload-misses-on-multifetch-cache Only preload misses on multifetch cache
| * | Only preload misses on multifetch cacheLachlan Sylvester2018-03-066-9/+101
| | |
* | | Merge pull request #32244 from bogdanvlviv/partly-revert-32231Kasper Timm Hansen2018-03-151-4/+2
|\ \ \ | | | | | | | | Partly revert #32231
| * | | Partly revert #32231bogdanvlviv2018-03-141-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove extra execution of `perform_enqueued_jobs` since it performs all enqueued jobs in the duration of the block. - Fix example of using `assert_emails` without block since we can't use enqueued jobs in this case.
* | | | Merge pull request #32260 from artfuldodger/patch-3Kasper Timm Hansen2018-03-151-1/+1
|\ \ \ \ | | | | | | | | | | Fix typo in active_job_basics.md
| * | | | Fix typo in active_job_basics.mdJon Evans2018-03-151-1/+1
|/ / / / | | | | | | | | `it's` -> `its`
* | | | Avoid dalli 2.7.7 for nowyuuji.yaginuma2018-03-152-2/+2
| | | | | | | | | | | | | | | | | | | | It's causing a test to fail. Ref: https://travis-ci.org/rails/rails/jobs/353758855#L1433-L1501
* | | | Merge pull request #32220 from rails/fix-time-columns-on-sqlite3Andrew White2018-03-157-11/+83
|\ \ \ \ | | | | | | | | | | Time column improvements
| * | | | Ensure that leading date is stripped by quoted_timeAndrew White2018-03-112-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #24542, quoted_time was introduced to strip the leading date component for time columns because it was having a significant effect in mariadb. However, it assumed that the date component was always 2000-01-01 which isn't the case, especially if the source wasn't another time column.
| * | | | Normalize date component when writing to time columnsAndrew White2018-03-113-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For legacy reasons Rails stores time columns on sqlite as full timestamp strings. However because the date component wasn't being normalized this meant that when they were read back they were being prefixed with 2001-01-01 by ActiveModel::Type::Time. This had a twofold result - first it meant that the fast code path wasn't being used because the string was invalid and second it was corrupting the second fractional component being read by the Date._parse code path. Fix this by a combination of normalizing the timestamps on writing and also changing Active Model to be more lenient when detecting whether a string starts with a date component before creating the dummy time value for parsing.
| * | | | Apply time column precision on assignmentAndrew White2018-03-113-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #20317, datetime columns had their precision applied on assignment but that behaviour wasn't applied to time columns - this commit fixes that. Fixes #30301.
* | | | | Merge pull request #32254 from sgrif/sg-dont-marshal-twiceSean Griffin2018-03-141-13/+14
|\ \ \ \ \ | | | | | | | | | | | | Don't marshal ActiveSupport::Cache::Entry objects twice
| * | | | | Don't marshal ActiveSupport::Cache::Entry objects twiceSean Griffin2018-03-141-13/+14
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When upgrading to Rails 5.2 we're seeing `ActiveSupport::Cache::Entry#compress` and `ActiveSupport::Cache::Entry#should_compress?` as the highest usage of our CPU. At least some part of this is coming from the fact that objects are being marshaled multiple times. This memoizes the marshaled value to eliminate half the problem.
* | | | | Merge pull request #32250 from ↵Andrew White2018-03-142-0/+14
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/add-info-about-exprity-of-siigned-cookies-to-upgrading-to-5-2 Update "Upgrading from Rails 5.1 to Rails 5.2" [ci skip]
| * | | | | Update "Upgrading from Rails 5.1 to Rails 5.2" [ci skip]bogdanvlviv2018-03-142-0/+14
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add section "Expiry in signed or encrypted cookie is now embedded in the cookies values" to `master` since it should always be in the guides, not only for version 5.2. Add info about `config.action_dispatch.use_authenticated_cookie_encryption` to the "Configuring Rails Applications" guide. It was committed straight to `5-2-stable` since we don't need this functionality in 6.0. Related to b25fcbc074ea688765af62a163698d5449221a8c.
* | | | | Pass the skip_pipeline option in image_submit_tagAndrew White2018-03-142-2/+4
| | | | | | | | | | | | | | | | | | | | Fixes #32248.
* | | | | Remove entry that was backported to Rails 5.1.3. [ci skip]Yuji Yaginuma2018-03-141-3/+0
| |/ / / |/| | |
* | | | Fix routing inspector tests broken in ↵Kasper Timm Hansen2018-03-131-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/rails/rails/commit/6629d51a2756fadf961bb09df20579cacfef2c8e * Renames grep_pattern to grep throughout. * Fixes setup not calling super by calling setup with a block. * Converts test helper method to a private one, like we have it other places. * Uses keyword arguments to get around awkward draw({ grep: "x" }, Action…) construction.
* | | | Rely on Rails::Command's help output.Kasper Timm Hansen2018-03-133-98/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We end up with: ``` Usage: bin/rails routes [options] Options: -c, [--controller=CONTROLLER] # Filter by a specific controller, e.g. PostsController or Admin::PostsController. -g, [--grep=GREP] # Grep routes by a specific pattern. -E, [--expanded], [--no-expanded] # Print routes expanded vertically with parts explained. ``` which does miss the bit about routes being printed in order. Also: * Renames options to ease help output readability, then clarifies each option. * Fixes a bunch of indentation.
* | | | Extract details to methods to clarify command.Kasper Timm Hansen2018-03-131-8/+12
| | | |
* | | | Remove changelog header for unreleased versionRafael Mendonça França2018-03-1310-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | We only add the header when releasing to avoid some conflicts. [ci skip]
* | | | Merge pull request #32231 from gmcgibbon/perform_email_jobs_in_assert_emailsRafael Mendonça França2018-03-133-6/+32
|\ \ \ \ | | | | | | | | | | | | | | | Perform email jobs in #assert_emails
| * | | | Perform email jobs in #assert_emailsGannon McGibbon2018-03-122-5/+29
| | | | | | | | | | | | | | | | | | | | Perform enqueued delivery jobs in #assert_emails and #assert_no_emails.
* | | | | Merge pull request #32153 from bogdanvlviv/rails-routes-32130Kasper Timm Hansen2018-03-134-62/+49
|\ \ \ \ \ | | | | | | | | | | | | Change message on the empty result of searching routes by `rails routes` with `-c` or `-g`
| * | | | | Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-133-59/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130
| * | | | | Improve docs of `ActionDispatch::Routing`bogdanvlviv2018-03-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a mention about `-g`. - Improve info about `--expanded` option of `rails routes`.
* | | | | | Merge pull request #32222 from ↵Kasper Timm Hansen2018-03-131-47/+896
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | bogdanvlviv/update-ruby_on_rails_5_2_release_notes Update "Ruby on Rails 5.2 Release Notes" Guide [ci skip]
| * | | | | Update "Ruby on Rails 5.2 Release Notes" Guide [ci skip]bogdanvlviv2018-03-131-47/+896
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a description of major features in Rails 5.2. - Add a reference to Pull Request/Commit to every entry in CHANGELOGs, note that some of them combined. - Add section "Ruby on Rails Guides" with notable changes. - Note that - Skipped this since encrypted secrets are already on the way out. ``` * Add `rails secrets:show` command. ([Pull Request](https://github.com/rails/rails/pull/29695)) ``` - Skipped this since it was backported all the way to 5-0-stable. ``` * Make Rails' test runner work better with minitest plugins. ([Pull Request](https://github.com/rails/rails/pull/29572)) ``` Thanks to everyone who has been working on Rails 5.2! <3
* | | | | Restore full Travis configGeorge Claghorn2018-03-121-1/+76
| | | | |
* | | | | Fix Azure signed URL generation with newer client libGeorge Claghorn2018-03-122-82/+5
| | | | |
* | | | | Redis cache store: fix constructing with a Redis instanceAdam Richardson2018-03-122-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since `Redis#call` duck types as a Proc, we'd call `#call` on it, thinking it's a Proc. Fixed by check for the Proc explicitly instead of duck typing on `#call`. References #32233
* | | | | Remove path option from AzureStorage configYuji Yaginuma2018-03-131-1/+0
| | | | | | | | | | | | | | | | | | | | Follow up of 309bb6c4d068b0d480681cf4ef1b90158527dfe5
* | | | | Update ASt test services configGeorge Claghorn2018-03-122-1/+1
|/ / / /
* | | | Remove path config option from Azure serviceAndrew White2018-03-123-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Active Storage service for Azure Storage has an option called `path` that is ambiguous in meaning. It needs to be set to the primary blob storage endpoint but that can be determined from the blobs client anyway. To simplify the configuration this commit removes the `path` option and gets the endpoint from the blobs client instead. Closes #32225.
* | | | [ci skip] Add missing do.Kasper Timm Hansen2018-03-121-1/+1
| | | |
* | | | Add section to routing guide about config/routes.rb [ci skip]Andrew White2018-03-121-0/+20
| | | | | | | | | | | | | | | | Closes #32219.
* | | | Merge pull request #32227 from ydakuka/fix-notes-marksEileen M. Uchitelle2018-03-127-9/+9
|\ \ \ \ | | | | | | | | | | Fix note marks
| * | | | Fix note marks [ci skip]Yauheni Dakuka2018-03-127-9/+9
|/ / / /
* | | | Merge pull request #32224 from bogdanvlviv/fix-rails_6_0-changelogsAndrew White2018-03-123-9/+7
|\ \ \ \ | | | | | | | | | | Fix CHANGELOGs [ci skip]
| * | | | Fix CHANGELOGs [ci skip]bogdanvlviv2018-03-123-9/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add missing dots. - Remove reference to itself on GitHub. Usually, we add references to fixed issues only in a changelog. Follow up #32223
* | | | Merge pull request #32160 from bogdanvlviv/improve-rails-routes-expandedKasper Timm Hansen2018-03-113-44/+67
|\ \ \ \ | | | | | | | | | | Draw line of a route name to the end of row console on `rails routes --expanded`
| * | | | Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-053-44/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to get width of console use `IO::console_size`, See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size Related to #32130
* | | | | Remove unnecessary `Hash.method_defined?(:dig)` checkingyuuji.yaginuma2018-03-111-13/+11
| | | | | | | | | | | | | | | | | | | | Since Rails 6 requires Ruby 2.4.1+.