Commit Graph

78934 Commits

Author SHA1 Message Date
Rafael Mendonça França
077c66d5d6
Rename master to main in all code references 2021-01-19 20:46:33 +00:00
Gannon McGibbon
2d817d7707
Merge pull request #41135 from gmcgibbon/initializer_warning_typo
Correct logic warning about initializers
2021-01-19 13:25:14 -05:00
Ryuta Kamizono
098fd7f9b3
Merge pull request #41164 from alpaca-tc/fixed_enum
Fixed multiple enums declaration with _prefix/_suffix
2021-01-19 15:38:20 +09:00
Ryuta Kamizono
60e979dde6
Merge pull request #41139 from kamipo/fix_decorated_type_with_serialized_attribute
Fix decorated type with `type_for_attribute` on the serialized attribute
2021-01-19 15:26:32 +09:00
alpaca-tc
f96de8bb66 Fixed multiple enums declaration with _prefix/_suffix
enum is broken when multiple values and `_prefix/_suffix: true` options
are passed.
Because the `enum_prefix/enum_suffix` variables are overwritten from `true` to
`name` during the first loop, and one should return `true` at the second loop, got already overwritten.

Introduced by https://github.com/rails/rails/pull/40992
2021-01-19 14:57:02 +09:00
Kasper Timm Hansen
db79da65f7
Merge pull request #41154 from c960657/patch-2
Explicit check for html and text parts
2021-01-18 17:33:00 +01:00
Jonathan Hefner
c219450c7a
Merge pull request #41155 from siaw23/fix-typos-grammar
Fix grammar and typos [ci-skip]
2021-01-18 10:29:16 -06:00
Emmanuel Hayford
055a8f0cbf Fix grammar and typos 2021-01-18 16:14:53 +01:00
Christian Schmidt
25f388b0f0
Explicit check for html and text parts
Attachments should not trigger format selector
2021-01-18 11:44:08 +01:00
Ross Kaffenberger
59009c2930
Add a Webpacker guide [ci skip] (#40817)
* Initial upload

* Moving toward a first pass

* Add Tables

I added tables for the configuration files/folders that are automatically generated.

I also added a table for the specific integrations. This way we can add basic links to the specific integration providing more detailed information about the integration.

* Add static assets section

* Bring over rails/webpacker development docs

* Respond to comments

* Update

* Update webpacker_guide.md

I think `include` should be `import` and would like to emphasis `import` over `require` in an effort to promote ES module syntax.

* Expand on image docs

I thought some additional details are needed to clarify image usage, especially from a Rails view.

* Update webpacker_guide.md

Add details for Webpacker + Docker section

* Update webpacker_guide.md

Make important distinction about pack files. Add example directory layout.

* Reword sentence

* Add section for Rails engines

* Rename webpacker guide

* Remove Docker section

* Add link to additional documentation

* Rework section formatting according to Rails guidelines

* Add link to webpack documentation

* Add note about NPM and Yarn

* Update guides/source/webpacker.md

Fix typo

Co-authored-by: Karl Entwistle <me@karlentwistle.com>

Co-authored-by: Noel Rappin <noel.rappin@joinroot.com>
Co-authored-by: Niklas Häusele <niklas.haeusele@gmail.com>
Co-authored-by: Tasos Latsas <tlatsas2000@gmail.com>
Co-authored-by: Noel Rappin <noelrappin@gmail.com>
Co-authored-by: Karl Entwistle <me@karlentwistle.com>
2021-01-18 11:40:18 +01:00
Ryuta Kamizono
f8eed695fa
Merge pull request #41152 from kamipo/fix_joins_with_reserved_word
Fix joins that reserved word association is referenced in `where`
2021-01-18 17:51:07 +09:00
Eugene Kenny
173e7ef16d
Merge pull request #41067 from eugeneius/relative_file_fixture_path
Fix fixture_file_upload deprecation with relative file_fixture_path
2021-01-18 08:16:11 +00:00
Ryuta Kamizono
00227ff3ee Fix joins that reserved word association is referenced in where
It is caused by #40749.

`Arel.sql`ed string will be avoided from quoting, it should be raw
string before using it for table alias.

Fixes https://github.com/rails/rails/issues/41010#issuecomment-761994291.
2021-01-18 16:24:22 +09:00
Ryuta Kamizono
e889cc55b0 Make ActiveModel's attribute behavior follow ActiveRecord's 2021-01-18 07:54:36 +09:00
Ryuta Kamizono
f54a15e9e3
Merge pull request #41147 from OuYangJinTing/fix_query_cache_is_dirty_after_perform_created
Fix ActiveRecord::ConnectionAdapters::QueryCache#dirties_query_cache
2021-01-17 22:43:05 +09:00
OuYangJinTing
79d5712205 Fix ActiveRecord::ConnectionAdapters::QueryCache#dirties_query_cache 2021-01-17 20:57:47 +08:00
Ryuta Kamizono
70259f5e51 Allow multiple decorations which can be used by such like EncryptedType 2021-01-17 11:38:40 +09:00
Ryuta Kamizono
5fc0c4c562 Revert "Merge pull request #39929 from jonathanhefner/decorate-original-attribute-type"
This reverts commit 79d0c17c654033279565f301545c418af68db597, reversing
changes made to bc828f74dffc79fdfea0a905219c08b00beb4d47.

Fixes #41138.
2021-01-16 14:44:50 +09:00
Ryuta Kamizono
b5ab89b9bf Add a regression test for decorated type with type_for_attribute
It is a regression test for #41138.
2021-01-16 14:40:28 +09:00
Ryuta Kamizono
5cfaefbd11 Just use regexp literal for assert_match 2021-01-16 12:40:59 +09:00
Ryuta Kamizono
8462129a1a
Merge pull request #41122 from pdcribeiro/fix-getting-started-guide
Fix article_params method

[ci skip]
2021-01-16 11:25:14 +09:00
Gannon McGibbon
3033f92de1 Correct logic warning about initializers
Defining initializer 4 to run before itself and after 3 is possible, but
not when the before constraint contradicts the after constraint via 2.
2021-01-15 20:29:59 -05:00
Diogo Ribeiro
e1970bb434 Fix article_params method 2021-01-15 09:57:32 +00:00
Gannon McGibbon
f250208dd4
Merge pull request #41115 from ghiculescu/failing-test-on-ruby-master
Fix test failing on ruby master
2021-01-14 13:32:16 -05:00
Ryuta Kamizono
291a3d2ef2 Exercise tests on decimal attribute values
And avoid the magic `to_d(4)`.
2021-01-14 17:21:25 +09:00
Ryuta Kamizono
63835772bb
Merge pull request #41019 from intrip/40902-fix-numericality-validator
Use round(scale) in  ActiveModel NumericalityValidator
2021-01-14 17:14:31 +09:00
Alex Ghiculescu
f9b4de06dc Fix test failing on ruby master 2021-01-13 19:16:30 -07:00
Eileen M. Uchitelle
7659dd0731
Merge pull request #41114 from eileencodes/add-association-name-to-strict-loading
Improve `strict_loading` violation error message
2021-01-13 17:06:19 -05:00
Jacopo
6657e3428b Change Numericaly validator to use round
f72f743 introduces truncate(scale) in the Numericality validator.
This behaviour conflicts with AR decimal type conversion,
which uses round(scale) instead.

Changes the Numericality validator in order to use
round(scale) for consistency.
2021-01-13 22:37:01 +01:00
eileencodes
48f3c3e201
Update platforms in Gemfile.lock
This keeps popping up after bundle on my local machine. We can
just add this to the lock file so there's no diff after bunding.
2021-01-13 15:12:23 -05:00
eileencodes
d2378bd3d8
Improve strict_loading violation error message
If you're using `strict_loading` in an application the previous message
only told you what class was lazily loaded. This change updates the
error message to include both the class and the association name. This
is useful because now you won't need to lookup the association name in
the application, the error message will tell you exactly which symbol
preload is missing.
2021-01-13 15:05:51 -05:00
John Hawthorn
879ee6e3d6
Merge pull request #41099 from jhawthorn/router_optional_part_of_segment
Fix issue routing with optional parts of a segment
2021-01-12 16:17:11 -08:00
John Hawthorn
c933b06317 Fix issue routing with optional parts of a segment
In our recent optimizations to route matching performance we introduced
an issue with routes that had an optional segment which wasn't separated
by a "." or "/".
2021-01-12 14:30:59 -08:00
Ryuta Kamizono
05dc13f91b
Merge pull request #41098 from kamipo/fix_source_type_with_symbol
Fix "NoMethodError: undefined method `-@'" for `source_type` with a symbol
2021-01-13 05:15:19 +09:00
Ryuta Kamizono
8b3c38f868 Fix "NoMethodError: undefined method -@'" for source_type` with a symbol
I missed that `source_type` would also be a symbol in c0750fe.
2021-01-13 04:52:07 +09:00
Ryuta Kamizono
f1b923b5d8
Merge pull request #41090 from kamipo/fix_find_by_with_custom_primary_key
Fix `find_by` with custom primary key for belongs_to association
2021-01-13 04:16:10 +09:00
Rafael França
8632a539c1
Merge pull request #41095 from Shopify/singleton-duplicable
Define Singleton#duplicable? and return false
2021-01-12 12:26:26 -05:00
Jean Boussier
a65b8a00cb Define Singleton#duplicable? and return false 2021-01-12 16:54:54 +01:00
Ryuta Kamizono
6f8fca882b Fix find_by with custom primary key for belongs_to association
Similar to #40809 which is fixed by #40815, but it is caused by dbda5fe.

`value.id if value.respond_to?(:id)` is not always correct if primary
key is customized on the belongs_to association.

Use `reflection.join_primary_key` in that case.

Fixes #41081.
2021-01-12 21:23:36 +09:00
Ryuta Kamizono
b453bff351 Inlining locked?
Since `locked?` and `arel_from_relation` overlaps, so just do
`arel_from_relation` first and inline `locked?`.
2021-01-12 18:14:08 +09:00
Ryuta Kamizono
0aa832e590
Merge pull request #41082 from kamipo/fix_update_optimistic_locking_without_default
Restore the ability that update/destroy optimistic locking object without default
2021-01-12 17:24:57 +09:00
Ryuta Kamizono
4db95d8432 Restore the ability that update/destroy optimistic locking object without default
The ability has lost due to reverted #39321 in #41049.

We should allow updating with dirty locking value to work the documented
usage, but if casted value has no difference (i.e. regarded as no dirty),
identify the object by the original (uninitialized default) value.
2021-01-12 09:27:11 +09:00
Rafael Mendonça França
15f6b64f43
Use _read_attribute instead of []
It is not only faster, it also doesn't raise an exception if the column
was not fetched in the model using select.
2021-01-11 23:19:21 +00:00
Ryuta Kamizono
8c60a2169a Add round up assertions for decimal tests 2021-01-12 06:16:21 +09:00
Ryuta Kamizono
47c2b7398a
Merge pull request #41079 from diasks2/fix_doc_typo
Fix typo in Action Text Overview guide

[ci skip]
2021-01-12 05:35:15 +09:00
Kevin Dias
3bab126641 Fix typo in Action Text Overview guide
Aciton Text -> Action Text
2021-01-12 04:03:46 +09:00
Kasper Timm Hansen
2afc9059c9
Merge pull request #41026 from santib/use-4xx-for-validations-errors-responses
Use 422 instead of 200 as the status code for form submission error responses
2021-01-11 00:03:32 +01:00
Ryuta Kamizono
dde814e906 Extract distinct_relation_for_primary_key on connection
It will allow adapter specific extension (single query by subquery,
distinct on, etc) in a future.
2021-01-10 12:13:45 +09:00
Eugene Kenny
a7b548a0e9 Fix fixture_file_upload deprecation with relative file_fixture_path
When using `Pathname#relative_path_from`, the receiver and the argument
must either both be absolute or both be relative:

https://ruby-doc.org/stdlib-2.7.2/libdoc/pathname/rdoc/Pathname.html#method-i-relative_path_from

> If self is absolute, then base_directory must be absolute too.
>
> If self is relative, then base_directory must be relative too.

If `file_fixture_path` is a relative path and `fixture_path` is an
absolute path, this line would previously raise an ArgumentError.
2021-01-09 19:14:12 +00:00
Ryuta Kamizono
19759dfaf3
Merge pull request #41064 from kamipo/enable_lint_duplicate_require_cop
Enable `Lint/DuplicateRequire` cop
2021-01-09 15:01:59 +09:00