rails/activestorage/test/models
eileencodes 226007daa1
Handle false in relation strict loading checks
Fixes: #41453
Closes: #41461

Previously when a model had strict loading set to true and then had a
relation set strict_loading to false the false wasn't considered when
deciding whether to raise/warn about strict loading.

Code example:

```ruby
class Dog < ActiveRecord::Base
  self.strict_loading_by_default = true

  has_many :treats, strict_loading: false
end
```

In the example, `dog.treats` would still raise even though
`strict_loading` was set to false. This is a bug effecting more than
Active Storage which is why I made this PR superceeding #41461. We need
to fix this for all applications since the behavior is a little
surprising. I took the test from ##41461 and the code suggestion from #41453
with some additions.

Co-authored-by: Radamés Roriz <radamesroriz@gmail.com>
2021-03-16 16:26:59 -04:00
..
attached Use image/jpeg instead of non-standard image/jpg 2021-03-05 13:14:11 -05:00
attachment_test.rb Handle false in relation strict loading checks 2021-03-16 16:26:59 -04:00
blob_test.rb Active Storage: Blob creation shouldn't crash if no service selected 2021-03-12 15:12:11 -05:00
filename_test.rb Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
presence_validation_test.rb Store newly-uploaded files on save rather than assignment 2018-07-07 23:25:33 -04:00
preview_test.rb Generate a preview without print margins 2020-09-17 11:59:45 -04:00
reflection_test.rb Named variants should be defined using block syntax 2020-05-04 13:04:14 +03:00
representation_test.rb Extract Analyzable and Representable concerns 2018-01-10 12:12:04 -05:00
strict_loading_test.rb Add strict loading for active storage 2020-11-16 22:09:15 +08:00
variant_test.rb Removed test for deprecated ASt combine_options transformation 2021-03-03 11:48:31 -05:00
variant_with_record_test.rb Make sure variant is created on the same service 2019-12-06 22:02:07 -05:00