aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #34406 from yahonda/use_rubocop_0_60_0Ryuta Kamizono2018-11-082-4/+1
|\ | | | | Use RuboCop 0.60.0 and remove exclude files for `Style/RedundantFreeze`
| * Use RuboCop 0.60.0 and remove exclude files for `Style/RedundantFreeze`Yasuo Honda2018-11-082-4/+1
|/ | | | | Since https://github.com/rubocop-hq/rubocop/pull/6333 has been included into RuboCop 0.60.0.
* Compile packs for testyuuji.yaginuma2018-11-081-2/+4
| | | | | `Webpacker` handles testing / development packs separately by default. If do not specify `RAILS_ENV`, there is no merit to precompile.
* Merge pull request #34385 from christophemaximin/guard-enum-empty-keysRyuta Kamizono2018-11-083-0/+26
|\ | | | | | | Guard Enums against definitions with blank label names
| * Guard Enums against definitions with blank label namesChristophe Maximin2018-11-073-1/+27
| |
* | Fix broken CHANGELOG markup [ci skip]Ryuta Kamizono2018-11-083-5/+5
|/ | | | And remove trailing spaces.
* Merge pull request #34181 from gmcgibbon/db_schema_cache_dump_and_clear_multi_dbEileen M. Uchitelle2018-11-074-5/+57
|\ | | | | Db schema cache dump and clear multi db
| * Add multi-db support to schema cache dump and clearGannon McGibbon2018-11-074-5/+57
|/ | | | | Adds support for multiple databases to `rails db:schema:cache:dump` and `rails db:schema:cache:clear`.
* Merge pull request #34393 from eugeneius/always_add_to_parent_transactionRyuta Kamizono2018-11-072-1/+12
|\ | | | | Always add records to parent of nested transaction
| * Always add records to parent of nested transactionEugene Kenny2018-11-072-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a record with transactional callbacks is saved, it's attached to the current transaction so that the callbacks can be run when the transaction is committed. Records can also be added manually with `add_transaction_record`, even if they have no transactional callbacks. When a nested transaction is committed, its records are transferred to the parent transaction, as transactional callbacks should only be run when the outermost transaction is committed (the "real" transaction). However, this currently only happens when the record has transactional callbacks, and not when added manually with `add_transaction_record`. If a record is added to a nested transaction, we should always attach it to the parent transaction when the nested transaction is committed, regardless of whether it has any transactional callbacks. [Eugene Kenny & Ryuta Kamizono]
* | Merge pull request #34387 from yhirano55/rails_info_properties_jsonRyuta Kamizono2018-11-075-2/+37
|\ \ | |/ |/| Respond /rails/info/properties.json
| * Add JSON support to rails properties route (`/rails/info/properties`).Yoshiyuki Hirano2018-11-075-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added json format, like this: { "Rails version": "6.0.0.alpha", "Ruby version": "2.5.1-p57 (x86_64-darwin17)", "RubyGems version": "2.7.6", "Rack version": "2.0.6", "JavaScript Runtime": "Node.js (V8)", "Middleware": ["Rack::Sendfile", "ActionDispatch::Static", "ActionDispatch::Executor", "ActiveSupport::Cache::Strategy::LocalCache::Middleware", "Rack::Runtime", "Rack::MethodOverride", "ActionDispatch::RequestId", "ActionDispatch::RemoteIp", "Sprockets::Rails::QuietAssets", "Rails::Rack::Logger", "ActionDispatch::ShowExceptions", "WebConsole::Middleware", "ActionDispatch::DebugExceptions", "ActionDispatch::Reloader", "ActionDispatch::Callbacks", "ActiveRecord::Migration::CheckPending", "ActionDispatch::Cookies", "ActionDispatch::Session::CookieStore", "ActionDispatch::Flash", "ActionDispatch::ContentSecurityPolicy::Middleware", "Rack::Head", "Rack::ConditionalGet", "Rack::ETag", "Rack::TempfileReaper"], "Application root": "/path/to/app", "Environment": "development", "Database adapter": "sqlite3", "Database schema version": 0 }
* | Merge pull request #34392 from gmcgibbon/gem_security_note_amendRafael França2018-11-0611-31/+31
|\ \ | | | | | | Amend CVE note and security guide section wordings
| * | Amend CVE note and security guide section wordingsGannon McGibbon2018-11-0611-31/+31
| | | | | | | | | | | | | | | | | | | | | Reword first sentence of dep management and CVE section of security guide. Also, reword and move gemspec notes above deps. [ci skip]
* | | Merge pull request #34375 from y-yagi/add_connect_src_to_default_csp_initializerGuillermo Iguaran2018-11-062-0/+15
|\ \ \ | |/ / |/| | Add `connect_src` example to content security policy initializer
| * | Add `connect_src` example to content security policy initializeryuuji.yaginuma2018-11-042-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If want to use `webpack-dev-server` with CSP enabled, need to specify `connect-src`. Related to: https://github.com/rails/webpacker/commit/cd7ecf4d48496341aecd81c0c2f69fe4e50a7cd4 This is a matter of `webpacker`. But since `webpacker` is now used by default, to prevent user confusion, I think that better to include an example of `connect-src.`
* | | Merge pull request #34388 from gmcgibbon/gem_security_noteKasper Timm Hansen2018-11-0611-0/+35
|\ \ \ | |_|/ |/| | Add CVE note to security guide and gemspecs
| * | Add CVE note to security guide and gemspecsGannon McGibbon2018-11-0611-0/+35
|/ / | | | | | | [ci skip]
* | Merge pull request #34384 from ↵Ryuta Kamizono2018-11-065-3/+26
|\ \ | | | | | | | | | | | | eugeneius/inspect_with_non_primary_key_id_attribute Fix inspect with non-primary key id attribute
| * | Fix inspect with non-primary key id attributeEugene Kenny2018-11-065-3/+26
|/ / | | | | | | | | | | | | | | | | | | | | The `read_attribute` method always returns the primary key when asked to read the `id` attribute, even if the primary key isn't named `id`, and even if another attribute named `id` exists. For the `inspect`, `attribute_for_inspect` and `pretty_print` methods, this behaviour is undesirable, as they're used to examine the internal state of the record. By using `_read_attribute` instead, we'll get the real value of the `id` attribute.
* | Merge pull request #34131 from lsylvester/defend-against-unmarshable-exceptionsEileen M. Uchitelle2018-11-051-1/+8
|\ \ | | | | | | Fix DRb::DRbServerNotFound errors in parallel tests
| * | resque errors caused by Marshal dump failures and wrap exceptions in ↵Lachlan Sylvester2018-10-091-1/+8
| | | | | | | | | | | | marshallable DRbRemoteError
* | | Merge pull request #34377 from nickcoyne/nickcoyne-patch-1Vipul A M2018-11-051-1/+1
|\ \ \ | |_|/ |/| | Fix typo [ci-skip]
| * | Fix typoNick Coyne2018-11-051-1/+1
|/ / | | | | Just a small typo fix for the recently merged #34257
* | Keep new line after the last dependencyyuuji.yaginuma2018-11-041-1/+1
| | | | | | | | | | If add a package with `yarn`, it will have a newline after the last dependency so let's match with that.
* | Move `resolve_sti_reflections` which is table row related code into `TableRow`Ryuta Kamizono2018-11-032-89/+78
| |
* | Don't pass useless `table_name` to `ModelMetadata.new`Ryuta Kamizono2018-11-033-13/+4
| | | | | | | | | | | | | | The `model_metadata` is only used if `model_class` is given. If `model_class` is given, the `table_name` is always `model_class.table_name`.
* | Don't pass unused `connection` to `FixtureSet.new`Ryuta Kamizono2018-11-032-14/+11
| | | | | | | | | | | | | | | | | | | | The `@connection` is no longer used since ee5ab22. Originally the `@connection` was useless because it is only used in `timestamp_column_names`, which is only used if `model_class` is given. If `model_class` is given, the `@connection` is always `model_class.connection`.
* | Checking boundable not only `IN` clause but also `NOT IN` clauseRyuta Kamizono2018-11-034-8/+24
| |
* | Merge pull request #34177 from rmacklin/convert-actioncable-to-es2015Javan Makhmali2018-11-0222-479/+3054
|\ \ | | | | | | Convert ActionCable javascript to ES2015 modules with a modern build environment
| * | Convert ActionCable javascript to ES2015 modules with modern build environmentRichard Macklin2018-11-0216-302/+2748
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've replaced the sprockets `//= require` directives with ES2015 imports. As a result, the ActionCable javascript can now be compiled with rollup (like ActiveStorage already is). - Rename action_cable/index.js.erb -> action_cable/index.js - Add rake task to generate a javascript module of the ActionCable::INTERNAL ruby hash This will allow us to get rid of ERB from the actioncable javascript, since it is only used to interpolate ActionCable::INTERNAL.to_json. - Import INTERNAL directly in ActionCable Connection module This is necessary to remove a load-order dependency conflict in the rollup-compiled build. Using ActionCable.INTERNAL would result in a runtime error: ``` TypeError: Cannot read property 'INTERNAL' of undefined ``` because ActionCable.INTERNAL is not set before the Connection module is executed. All other ActionCable.* references are executed inside of the body of a function, so there is no load-order dependency there. - Add eslint and eslint-plugin-import devDependencies to actioncable These will be used to add a linting setup to actioncable like the one in activestorage. - Add .eslintrc to actioncable This lint configuration was copied from activestorage - Add lint script to actioncable This is the same as the lint script in activestorage - Add babel-core, babel-plugin-external-helpers, and babel-preset-env devDependencies to actioncable These will be used to add ES2015 transpilation support to actioncable like we have in activestorage. - Add .babelrc to actioncable This configuration was copied from activestorage - Enable loose mode in ActionCable's babel config This generates a smaller bundle when compiled - Add rollup devDependencies to actioncable These will be used to add a modern build pipeline to actioncable like the one in activestorage. - Add rollup config to actioncable This is essentially the same as the rollup config from activestorage - Add prebuild and build scripts to actioncable package These scripts were copied from activestorage - Invoke code generation task as part of actioncable's prebuild script This will guarantee that the action_cable/internal.js module is available at build time (which is important, because two other modules now depend on it). - Update actioncable package to reference the rollup-compiled files Now that we have a fully functional rollup pipeline in actioncable, we can use the compiled output in our npm package. - Remove build section from ActionCable blade config Now that rollup is responsible for building ActionCable, we can remove that responsibility from Blade. - Remove assets:compile and assets:verify tasks from ActionCable Now that we've added a compiled ActionCable bundle to version control, we don't need to compile and verify it at publish-time. (We're following the pattern set in ActiveStorage.) - Include compiled ActionCable javascript bundle in published gem This is necessary to maintain support for depending on the ActionCable javascript through the Sprockets asset pipeline. - Add compiled ActionCable bundle to version control This mirrors what we do in ActiveStorage, and allows ActionCable to continue to be consumed via the sprockets-based asset pipeline when using a git source instead of a published version of the gem.
| * | Refactor decaffeinate output to more natural/idiomatic javascriptRichard Macklin2018-11-026-279/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove unnecessary Array.from usages from subscriptions.js These were all Arrays before, so Array.from is a no-op - Remove unnecessary IIFEs from subscriptions.js - Manually decaffeinate sample ActionCable code in comments Here the coffeescript -> ES2015 conversion was done by hand rather than using decaffeinate, because these code samples were simple enough. - Refactor ActionCable.Subscription to avoid initClass - Refactor ActionCable.Subscription to use ES2015 default parameters - Refactor ActionCable.ConnectionMonitor to avoid initClass - Refactor ActionCable.ConnectionMonitor to use shorter variations of null checks - Remove unnecessary code created because of implicit returns in ConnectionMonitor This removes the `return` statements that were returning the value of console.log and those from private methods whose return value was not being used. - Refactor ActionCable.Connection to avoid initClass - Refactor Connection#isProtocolSupported and #isState This addresses these three decaffeinate cleanup suggestions: - DS101: Remove unnecessary use of Array.from - DS104: Avoid inline assignments - DS204: Change includes calls to have a more natural evaluation order It also removes the use of Array.prototype.includes, which means we don't have to worry about providing a polyfill or requiring that end users provide one. - Refactor ActionCable.Connection to use ES2015 default parameters - Refactor ActionCable.Connection to use shorter variations of null checks - Remove return statements that return the value of console.log() in ActionCable.Connection - Simplify complex destructure assignment in connection.js decaffeinate had inserted ``` adjustedLength = Math.max(protocols.length, 1) ``` to be safe, but we know that there has to always be at least one protocol, so we don't have to worry about protocols.length being 0 here. - Refactor Connection#getState The decaffeinate translation of this method was not very clear, so we've rewritten it to be more natural. - Simplify destructure assignment in connection.js - Remove unnecessary use of Array.from from action_cable.js.erb - Refactor ActionCable#createConsumer and #getConfig This addresses these two decaffeinate cleanup suggestions: - DS104: Avoid inline assignments - DS207: Consider shorter variations of null checks - Remove unnecessary code created because of implicit returns in action_cable.js.erb This removes the `return` statements that were returning the value of console.log and those from methods that just set and unset the `debugging` flag. - Remove decaffeinate suggestion about avoiding top-level this In this case, the top-level `this` is intentional, so it's okay to ignore this suggestion. - Remove decaffeinate suggestions about removing unnecessary returns I did remove some of the return statements in previous commits, where it seemed appropriate. However, the rest of these should probably remain because the return values have been exposed through the public API. If we want to break that contract, we can do so, but I think it should be done deliberately as part of a breaking-API change (separate from this coffeescript -> ES2015 conversion) - Remove unused `unsupportedProtocol` variable from connection.js Leaving this would cause eslint to fail - Refactor Subscriptions methods to avoid `for` ... `of` syntax Babel transpiles `for` ... `of` syntax to use `Symbol.iterator`, which would require a polyfill in applications that support older browsers. The `for` ... `of` syntax was produced by running `decaffeinate`, but in these instances a simpler `map` should be sufficient and avoid any `Symbol` issues.
| * | Run decaffeinate on action_cable/*.jsRichard Macklin2018-11-026-401/+581
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using [decaffeinate], we have converted these files from coffeescript syntax to ES2015 syntax. Decaffeinate is very conservative in the conversion process to ensure exact coffeescript semantics are preserved. Most of the time, it's safe to clean up the code, and decaffeinate has left suggestions regarding potential cleanups we can take. I'll tackle those cleanups separately. After running decaffeinate, I ran: ``` eslint --fix app/javascript ``` using the eslint configuration from ActiveStorage to automatically correct lint violations in the decaffeinated output. This removed 189 extra semicolons and changed one instance of single quotes to double quotes. Note: decaffeinate and eslint can't parse ERB syntax. So I worked around that by temporarily quoting the ERB: ```diff @ActionCable = - INTERNAL: <%= ActionCable::INTERNAL.to_json %> + INTERNAL: "<%= ActionCable::INTERNAL.to_json %>" WebSocket: window.WebSocket logger: window.console ``` and then removing those quotes after running decaffeinate and eslint. [decaffeinate]: https://github.com/decaffeinate/decaffeinate
| * | Move actioncable javascript to app/javascript and change .coffee -> .jsRichard Macklin2018-11-026-0/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename action_cable/*.coffee -> *.js - Move app/assets/javascripts/* -> app/javascript/* - Rename action_cable.js.erb -> action_cable/index.js.erb Renaming the extension to .js is in preparation for converting these files from coffeescript to ES2015. Moving the files to app/javascript and putting the entry point in index.js.erb changes the structure of ActionCable's javascript to match the structure of ActiveStorage's javascript. (We are doing the file moving and renaming in a separate commit to ensure that the git history of the files will be preserved - i.e. git will track these as file renames rather than unrelated file additions/deletions. In particular, git blame will still trace back to the original authorship.)
* | Merge pull request #34360 from ↵Rafael França2018-11-013-0/+13
|\ \ | | | | | | | | | | | | weilandia/34359_hash_with_indifferent_access_to_options Make ActiveSupport HashWithIndifferentAccess#to_options and alias for HashWithIndifferentAccess#symbolize_keys
| * | Make #to_options an alias for #symbolize_keysNick Weiland2018-11-013-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #34359 Prior to 5.2.0 (2cad8d7), HashWithIndifferentAccess#to_options acted as an alias to HashWithIndifferentAccess#symbolize_keys. Now, #to_options returns an instance of HashWithIndifferentAccess while #symbolize_keys returns and instance of Hash. This pr makes it so HashWithIndifferentAccess#to_options acts as an alias for HashWithIndifferentAccess#symbolize_keys once again.
* | | Merge pull request #34361 from esparta/update_sample_callback_before_destroyRyuta Kamizono2018-11-011-1/+1
|\ \ \ | |/ / |/| | Updating sample code on ActiveRecord#before_destroy callback [ci skip]
| * | Updating sample code on ActiveRecord#before_destroy callback [ci skip]Espartaco Palma2018-10-311-1/+1
|/ / | | | | | | It was executing a delete_all method with wrong parameter
* | Merge pull request #34356 from gmcgibbon/docs_i18n_with_locale_threadsafeRafael França2018-10-311-15/+23
|\ \ | | | | | | Make i18n locale setting docs use around_action
| * | Make i18n locale setting docs use around_actionGannon McGibbon2018-10-311-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Changes `I18n.locale` assignment in docs to use `I18n.with_locale` in `around_action` to ensure locale resetting after action processing. [ci skip] [Gannon McGibbon + Leonardo Tegon]
* | | Fix "warning: shadowing outer local variable - role"Ryuta Kamizono2018-10-311-9/+13
| | | | | | | | | | | | Caused at #34196.
* | | Merge pull request #34355 from esquith/patch-1Gannon McGibbon2018-10-301-1/+1
|\ \ \ | | | | | | | | Update authorization.rb
| * | | Update authorization.rbEsquith Allen2018-10-301-1/+1
| | | |
* | | | Restore HWIA support to AJ::Arguments.deserializeGannon McGibbon2018-10-303-1/+13
| | | | | | | | | | | | | | | | | | | | Restore HashWithIndifferentAccess support to ActiveJob::Arguments.deserialize.
* | | | Merge pull request #34353 from gmcgibbon/fix_lock_docs_locking_clauseRafael França2018-10-301-3/+3
|\ \ \ \ | |/ / / |/| | | Fix example for database-specific locking clause
| * | | Fix example for database-specific locking clauseGannon McGibbon2018-10-301-3/+3
| |/ / | | | | | | | | | [ci skip]
* | | Merge pull request #33972 from bogdanvlviv/follow-up-33897Rafael França2018-10-302-9/+13
|\ \ \ | | | | | | | | Improve `enqueue_retry.active_job` message
| * | | Improve `enqueue_retry.active_job` messagebogdanvlviv2018-09-252-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #33751 was added `enqueue_retry.active_job` instrumentation to the `retry_on` method, then #33897 moved the instrumentation to `retry_job` method in order to ensure that this method publish `enqueue_retry.active_job` notification too. See related discussion https://github.com/rails/rails/pull/33751#discussion_r214140008 Since `enqueue_retry.active_job` moved to `retry_job`, there is no guarantee that payload of `enqueue_retry.active_job` would have `:error`. See test `LoggingTest#test_enqueue_retry_logging_on_retry_job` as example of that case. Related to https://github.com/rails/rails/pull/33897#discussion_r219707024 I think we can improve notification of `enqueue_retry.active_job`: - If there is no `event.payload[:error]`, then publish like "Retrying RescueJob in 3 seconds." only. - If `event.payload[:wait]` is `nil`, then publish "Retrying RescueJob in 0 seconds." instead of "Retrying RescueJob in nil seconds." - If there is `event.payload[:error]`, then publish "Retrying RescueJob in 3 seconds, due to a DefaultsError.". - Change the type of the message from `error` to `info.` Also, this commit removes part of messages - "The original exception was #{ex.cause.inspect}." of `enqueue_retry.active_job`, `retry_stopped.active_job`, and `discard.active_job` since I haven't found it useful. Please let me know whether you agree with that?
* | | | Fix failing testSean Griffin2018-10-301-0/+1
| |/ / |/| | | | | | | | | | | b63701e moved the assignment before the query, but we need to capture our old id before assignment in case we are assigning the id.
* | | `update_columns` raises if the column is unknownSean Griffin2018-10-304-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previosly, `update_columns` would just take whatever keys you gave it and tried to run the update query. Most likely this would result in an error from the database. However, if the column actually did exist, but was in `ignored_columns`, this would result in the method returning successfully when it should have raised, and an attribute that should not exist written to `@attributes`.