| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The error message uses English to say that the object should respond
to a certain method. You check that with respond_to, but that's not
English.
This makes this error message also consistent with the rest.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Based on my benchmark results, this change improves performance
substantially when defining callbacks.
This benchmark (https://gist.github.com/wangjohn/5542610) was run using
the current master and also using my experimental branch which replaced
class_eval with define_single_method.
Using class_eval (current master):
user system total real
10 trials 0.000000 0.000000 0.000000 ( 0.001568)
50 trials 0.020000 0.000000 0.020000 ( 0.021715)
500 trials 0.110000 0.000000 0.110000 ( 0.115357)
1000 trials 0.250000 0.000000 0.250000 ( 0.260025)
10000 trials 2.560000 0.000000 2.560000 ( 2.568408)
50000 trials 12.800000 0.010000 12.810000 ( 12.886871)
Using define_single_method (experimental branch):
user system total real
10 trials 0.000000 0.000000 0.000000 ( 0.000790)
50 trials 0.000000 0.000000 0.000000 ( 0.002960)
500 trials 0.050000 0.010000 0.060000 ( 0.055690)
1000 trials 0.100000 0.000000 0.100000 ( 0.094073)
10000 trials 0.890000 0.000000 0.890000 ( 0.900364)
50000 trials 4.650000 0.000000 4.650000 ( 4.686127)
|
| | |
| | |
| | |
| | |
| | | |
I also attempted to fix other styleguide violations such as
{ a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
* Highlights the requirement of an attributes method.
* Removes some details that depend on the implementation of the class including the module.
* Applies guidelines here and there.
|
| | | |
|
| | |
| | |
| | |
| | | |
Add a working example of how to use this new method.
|
| | | |
|
|\ \ \
| | | |
| | | | |
Add #to_s method to VERSION modules
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Just raising from the rescue block will re-raise the exception, so the
variable is not necessary.
|
| | | | |
|
|/ / /
| | |
| | |
| | | |
rest of the code the wat the includes are done
|
| | |
| | |
| | |
| | |
| | |
| | | |
it only cleared the validations that created :validate callbacks. This
didn't include the validates created by validates_with, so I've added a
method to clear all validations.
|
|\ \ \
| | | |
| | | | |
`has_secure_password` is not invalid when assigning empty Strings
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Closes #9535.
With 692b3b6 the `password=` setter does no longer set blank passwords.
This triggered validation errors when assigning empty Strings to `password`
and `password_confirmation`.
This patch only sets the confirmation if it is not `blank?`.
|
| | | | |
|
|/ / / |
|
| | | |
|
| | |
| | |
| | | |
As discussed with @josevalim on Ruby Rogues Parley.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing
changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
|
| | | |
|
| | |
| | |
| | |
| | | |
Makes it easier to test its objects.
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
Conflicts:
guides/source/getting_started.md
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
right place.
The EachValidator#validate already handle :allow_blank and :allow_nil,
correctly.
Closes #8622.
Fix #8621.
|
| |
| |
| |
| |
| | |
Conflicts:
activemodel/lib/active_model/errors.rb
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
We don't need to define a new method in ActiveMode::Errors for each
validatior.
See
https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
|
| |
| |
| |
| |
| |
| | |
absence of attributes.
Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
|
|\ \
| | |
| | | |
Thread safety improvements
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Summary of the changes:
* Add thread_safe gem.
* Use thread safe cache for digestor caching.
* Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
* Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
* Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
* Replace synchronisation with TS::Cache usage.
* Use a preallocated array for performance/memory reasons.
* Update the controllers cache to the new AS::Dependencies::ClassCache API.
The original @controllers cache no longer makes much sense after @tenderlove's
changes in 7b6bfe84f3 and f345e2380c.
* Use TS::Cache in the connection pool to avoid locking overhead.
* Use TS::Cache in ConnectionHandler.
|
|/ /
| |
| |
| |
| | |
Both String and Date now respond to in_time_zone so we need to
check if the value is a Time or a DateTime.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).
This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When resetting an attribute, you expect it to return to the state it was
before any changes. Namely, this fixes this unexpected behavior:
~~~ruby
model.name = "Bob"
model.reset_name!
model.name_changed? #=> true
~~~
|
| |
| |
| |
| |
| |
| |
| |
| | |
They was extracted from a plugin.
See https://github.com/rails/rails-observers
[Rafael Mendonça França + Steve Klabnik]
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When serialising a class, specify the type of any singular associations, if
necessary. Rails already correctly specifies the :type of any enumerable
association (e.g. a has_many association), but made no attempt to do so for
non-enumerables (e.g. a has_one association).
We must specify the :type of any STI association. A has_one
association to a class which uses single-table inheritance is an example of
this type of association.
Fixes #7471
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Length validation handles correctly nil. Fix #7180
Conflicts:
activemodel/CHANGELOG.md
|
| | |
| | |
| | |
| | | |
When nil or empty string are not allowed, they are not valid.
|
| | | |
|
|/ / |
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
actionpack/lib/action_dispatch/routing/redirection.rb
|