1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

7 commits

Author SHA1 Message Date
Sean Griffin
b63701e272 update_columns raises if the column is unknown
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`.
2018-10-30 12:52:23 -06:00
Ryuta Kamizono
3579876931 Active Model: Use private attr_reader
Follow up of 6d63b5e49a.
2018-02-26 06:16:24 +09:00
Ryuta Kamizono
a954e1e817 Merge pull request #29018 from willbryant/missing_attributes_after_save
fix the dirty tracking code's save hook overwriting missing attribute…
2018-01-03 05:14:18 +09:00
Ryuta Kamizono
24b59434e6
Add missing autoload Type (#31123)
Attribute modules (`Attribute`, `Attributes`, `AttributeSet`) uses
`Type`, but referencing `Type` before the modules still fail.

```
% ./bin/test -w test/cases/attribute_test.rb -n test_with_value_from_user_validates_the_value
Run options: -n test_with_value_from_user_validates_the_value --seed 31876

E

Error:
ActiveModel::AttributeTest#test_with_value_from_user_validates_the_value:
NameError: uninitialized constant ActiveModel::AttributeTest::Type
    /Users/kamipo/src/github.com/rails/rails/activemodel/test/cases/attribute_test.rb:233:in `block in <class:AttributeTest>'

bin/test test/cases/attribute_test.rb:232

Finished in 0.002985s, 335.0479 runs/s, 335.0479 assertions/s.
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
```

Probably we need more autoloading at least `Type`.
2017-11-11 06:43:54 +09:00
yuuji.yaginuma
1cddc91a02 Add missing requires
Currently, executing the test with only `attribute_test.rb` results in an error.

```
./bin/test -w test/cases/attribute_test.rb
Run options: --seed 41205

# Running:

....E

Error:
ActiveModel::AttributeTest#test_attributes_do_not_equal_attributes_with_different_types:
NameError: uninitialized constant ActiveModel::AttributeTest::Type
    rails/activemodel/test/cases/attribute_test.rb:159:in `block in <class:AttributeTest>'

bin/test test/cases/attribute_test.rb:158
```

Added a missing require to fix this.
2017-11-10 19:26:32 +09:00
yuuji.yaginuma
c59ab795ee Add missing requires
Currently, executing the test with only `attribute_set_test.rb` results in an error.

```
./bin/test -w test/cases/attribute_set_test.rb
Run options: --seed 33470

# Running:

E

Error:
ActiveModel::AttributeSetTest#test_#map_returns_a_new_attribute_set_with_the_changes_applied:
NameError: uninitialized constant ActiveModel::AttributeSetTest::AttributeSet
Did you mean?  ActiveModel::Attributes
               ActiveModel::Attribute
    activemodel/test/cases/attribute_set_test.rb:235:in `block in <class:AttributeSetTest>'

bin/test test/cases/attribute_set_test.rb:234
```

Added a missing require to fix this.

Also, I suspect that this is the cause of failures in CI.
Ref: https://travis-ci.org/rails/rails/jobs/299994708
2017-11-10 14:28:02 +09:00
Lisa Ugray
c3675f50d2 Move Attribute and AttributeSet to ActiveModel
Use these to back the attributes API.  Stop automatically including
ActiveModel::Dirty in ActiveModel::Attributes, and make it optional.
2017-11-09 14:29:39 -05:00
Renamed from activerecord/lib/active_record/attribute.rb (Browse further)