- 04 6月, 2020 10 次提交
-
-
由 Jonathan Hefner 提交于
Follow-up to #39344. This adds back coverage of `collection_select`, adds new coverage of `collection_radio_buttons`, revises existing coverage of `collection_check_boxes`, and unifies these sections.
-
由 Jonathan Hefner 提交于
Follow-up to #39344. Adds back mention of `text_area` helper.
-
由 Ryuta Kamizono 提交于
It is a super edge case but the alias should be resolved before `clear_attribute_changes` since `clear_attribute_changes` is not aware of attribute aliases.
-
由 Ryuta Kamizono 提交于
Redundant `to_s` has a few overhead. Especially private methods are not intend to be passed user input directly so it should be passed always string. Removing redundant `to_s` makes attribute methods about 10% faster. ```ruby ActiveRecord::Schema.define do create_table :users, force: true do |t| end end class User < ActiveRecord::Base def fast_read_attribute(attr_name, &block) @attributes.fetch_value(attr_name, &block) end end user = User.create! Benchmark.ips do |x| x.report("user._read_attribute('id')") { user._read_attribute("id") } x.report("user.fast_read_attribute('id')") { user.fast_read_attribute("id") } end ``` ``` Warming up -------------------------------------- user._read_attribute('id') 272.151k i/100ms user.fast_read_attribute('id') 283.518k i/100ms Calculating ------------------------------------- user._read_attribute('id') 2.699M (± 1.3%) i/s - 13.608M in 5.042846s user.fast_read_attribute('id') 2.988M (± 1.2%) i/s - 15.026M in 5.029056s ```
-
由 Ryuta Kamizono 提交于
Promote `clear_attribute_change` as attribute methods
-
由 Eugene Kenny 提交于
Do not mark attributes as changed when the type is case insensitive a…
-
由 Peter Fry 提交于
Do not mark Postgresql MAC address and UUID attributes as changed when the assigned value only varies by case. Fix Rubocop warnings. Fix merge conflict error. Fix merge conflict error.
-
由 Ryuta Kamizono 提交于
For now, `increment` with aliased attribute does work, but `increment!` with aliased attribute does not work, due to `clear_attribute_change` is not aware of attribute aliases. We sometimes partially updates specific attributes in dirties, at that time it relies on `clear_attribute_change` to clear partially updated attribute dirties. If `clear_attribute_change` is not attribute method unlike others, we need to resolve attribute aliases manually only for `clear_attribute_change`, it is a little inconvinient for me. From another point of view, we have `restore_attributes`, `restore_attribute!`, `clear_attribute_changes`, and `clear_attribute_change`. Despite almost similar features `restore_attribute!` is an attribute method but `clear_attribute_change` is not. Given the above, I'd like to promote `clear_attribute_change` as attribute methods to fix issues caused by the inconsisteny.
-
由 Aaron Patterson 提交于
Make custom inspect methods more consistent
-
由 Ryuta Kamizono 提交于
-
- 03 6月, 2020 16 次提交
-
-
由 Eugene Kenny 提交于
Fix issue with expression index in insert_all
-
由 Austen Madden 提交于
Based on the docs which state unique_by option of insert_all can use the index name if desired, one would expect the method to work normally and use the `unique_by` option to determine duplicates. However, there's an issue where the insert_all expects a Set instead of the string representing the index expression it is given. This causes an error. Returning the string expression instead of attempting to format it works perfectly though.
-
由 Eugene Kenny 提交于
Replace 'Stubs out' with 'Generates' in generator USAGE's [ci skip]
-
由 Eugene Kenny 提交于
Alias direct_descendants as subclasses
-
由 Petrik 提交于
Generators generate things, but what is meant by 'Stubbing out' might confuse beginners and non-native English speakers. While generated tests are stubs that should have an implementation, a generated model is a valid model that doesn't require any changes.
-
由 fatkodima 提交于
-
由 Jonathan Hefner 提交于
This alias overrides Class#subclasses. Thus calls to `subclasses` get a free performance boost when the class extends DescendantsTracker.
-
由 Ryuta Kamizono 提交于
Support attribute aliases for `type_for_attribute`
-
由 Ryuta Kamizono 提交于
-
由 Haroon Ahmed 提交于
-
由 Ryuta Kamizono 提交于
Ensure column names on reflection as a string
-
由 Ryuta Kamizono 提交于
Use `join_primary_key` and `join_foreign_key` directly.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Similar with #39496.
-
由 Ryuta Kamizono 提交于
If association column names are defined as a symbol, association access will cause `Symbol#to_s` each time since attributes and columns hash keys are a string. To avoid that extra `Symbol#to_s` allocation, ensure column names on reflection as a string.
-
由 Ryuta Kamizono 提交于
`has_attribute?` should be aware of attribute aliases
-
- 02 6月, 2020 10 次提交
-
-
由 Ryuta Kamizono 提交于
Related to #39495. For now, `read_attribute`, `write_attribute`, `[]`, `[]=` are aware of attribute aliases, but `has_attribute?` is not. It will easily miss attribute alias resolution before using `has_attribute?`, it is very inconvenient. I think the inconvenience is not intended, so `has_attribute?` should be aware of attribute aliases like as others for consistency.
-
由 Ryuta Kamizono 提交于
Allow attribute aliases for `validates_uniqueness_of`
-
由 Ryuta Kamizono 提交于
Fix test name that no longer raises exception
-
由 Petrik 提交于
-
由 Eugene Kenny 提交于
Use size == 1 instead of one? to check hashes count in HashWithIndifferentAccess#update
-
由 Kasper Timm Hansen 提交于
This is most easiest done by switching to before_setup, which fits since we're also testing the ordering of the reset calls provided by the TestHelper.
-
由 Eugene Kenny 提交于
Don't recommend disabling CSRF protection [ci skip]
-
由 Kasper Timm Hansen 提交于
Reset ActiveSupport::CurrentAttributes even where executor doesn't wrap
-
由 Eugene Kenny 提交于
The previous example disables CSRF protection for JSON format requests, which allows any request to bypass it by adding the right Accept header. Accept is one of the few headers that doesn't trigger a CORS preflight: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Examples_of_access_control_scenarios Instead of disabling it entirely, the simple case where authentication is handled without a session (e.g. when using API keys) can be solved by switching to the `:null_session` strategy. For more complex cases (e.g. an API that uses session authentication), I don't think a copy-and-paste-able example is appropriate; the user needs to understand CSRF protection in order to make an informed choice.
-
由 Jeremy Daer 提交于
AD::Static refactor with precompressed Brotli support
-
- 01 6月, 2020 4 次提交
-
-
由 Jeremy Daer 提交于
-
由 Ryan Hall 提交于
When using an external build process (webpack, grunt) it's helpful for rails to be able to serve those assets. Brotli has better compression than gzip and should eventually replace it for static assets. When using an external build process (webpack, grunt) it's helpful for rails to be able to serve those assets. Brotli has better compression than gzip and will eventually replace it for static assets.
-
由 Vipul A M 提交于
Added link to infosec.mozilla.org under the security guide [ci skip]
-
由 Mads Jensen 提交于
-