| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The same is not true of `define_attribute`, which is meant to be the low
level no-magic API that sits underneath. The differences between the two
APIs are:
- `attribute`
- Lazy (the attribute will be defined after the schema has loaded)
- Allows either a type object or a symbol
- `define_attribute`
- Runs immediately (might get trampled by schema loading)
- Requires a type object
This was the last blocker in terms of public interface requirements
originally discussed for this feature back in May. All the
implementation blockers have been cleared, so this feature is probably
ready for release (pending one more look-over by me).
|
|
|
|
| |
onwards.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The detection of in-place changes caused a weird unexpected issue with
numericality validations. That validator (out of necessity) works on the
`_before_type_cast` version of the attribute, since on an `:integer`
type column, a non-numeric string would type cast to 0.
However, strings are mutable, and we changed strings to ensure that the
post type cast version of the attribute was a different instance than
the before type cast version (so the mutation detection can work
properly).
Even though strings are the only mutable type for which a numericality
validation makes sense, special casing strings would feel like a strange
change to make here. Instead, we can make the assumption that for all
mutable types, we should work on the post-type-cast version of the
attribute, since all cases which would return 0 for non-numeric strings
are immutable.
Fixes #17852
|
|
|
|
|
| |
`Computer` class needs to be require
See #17217 for more details
|
|
|
|
|
| |
Acts same as valid? but raises AR::RecordInvalid exception
if validation fails
|
|\
| |
| |
| |
| | |
take/change-test-name-for-ActiveRecord--Validations#valid-
Refactor AR's validations_test.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `:context` switch feature is implemented in
ActiveRecord::Validations#valid? method, so we should rename the test
names, and execute `valid?` in the test.
Change test name in AR's validations_test.rb
This test is testing save method's code
|
| |
| |
| |
| |
| |
| |
| |
| | |
It's unintuitive to call '#valid?' when you want to run validations but
don't care about the return value.
The alias in ActiveRecord isn't strictly necessary (the ActiveModel
alias is still in effect), but it clarifies.
|
|/
|
|
|
|
| |
Change most tests to make use of assert_raise returning the raised
exception rather than relying on a combination of flunk + rescue to
check for exception types/messages.
|
| |
|
| |
|
| |
|
|
|
|
| |
method.
|
| |
|
|
|
|
| |
RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
|
|
|
|
| |
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
|
|
| |
[#5153 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
|
|
| |
[#4804 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
|
| |
|
|
|
|
|
|
| |
[#4654 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
|
| |
|
|
|
|
| |
Antonio)
|
| |
|
|
|
|
|
|
| |
[#3826 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
|
|
|
| |
status:resolved]
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
deprecated error messages and add i18n_scope and lookup_ancestors.
Signed-off-by: Carl Lerche <carllerche@mac.com>
|
|
|
|
| |
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
|
|
|
|
|
| |
notifying events that are actually being consumed.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
|
|
|
|
| |
Model.validate :method and likewise
|
| |
|
| |
|
|
|
|
| |
ActiveRecord::Validations
|
| |
|
| |
|
| |
|
|
|
|
| |
[#1617 state:resolved]
|
|
|
|
|
|
| |
state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
|
|
|
|
|
| |
state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
| |
|
|
|
|
|
| |
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1057 state:committed]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
validations_test.rb [#674 state:resolved]
Many of the tests in validations_test would add a new validation to
models. However, only Topic was being reset with a fairly aggressive
clearing of all validations. None of the other models being used however
were recieving the same treatment. Now we use repair_validations(Topic)
for the whole test case because most test cases use Topic and then the
block form of repair_validations(<other_models>) inside any tests that use
other models.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
|
|
|
|
|
| |
newline characters
Signed-off-by: Michael Koziarski <michael@koziarski.com>
|
|
|
|
|
|
| |
syntax any more
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
|
|
|
| |
Signed-off-by: Michael Koziarski <michael@koziarski.com>
|
|
|
|
| |
[#860 state:resolved]
|
|
|
|
|
|
| |
This reverts commit aee14630d4dc0856e597794cc731fac68c2d2e34.
[#860 state:incomplete]
|
|
|
|
| |
Signed-off-by: Michael Koziarski <michael@koziarski.com>
|