| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
|
| |
`:foreign_type` is a valid option for `belongs_to` and `has_one`
so remove this to `SingularAssociation`.
|
|
|
|
|
|
| |
This class is only used internally. We should keep it out of public
documentation. This patch adds nodoc for
`ActiveRecord::Associations::Builder` and everything nested within.
|
|
|
|
| |
Deprecate `required` option in favor of `optional` for belongs_to.
|
| |
|
|
|
|
|
|
|
| |
To be possible to use a custom column name to save/read the polymorphic
associated type in a has_many or has_one polymorphic association, now users
can use the option :foreign_type to inform in what column the associated object
type will be saved.
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug, when ':dependent => :destroy' violates foreign key constraints
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/associations/builder/association.rb
activerecord/lib/active_record/associations/builder/has_one.rb
|
| |
| |
| |
| | |
constraints, issue #12380
|
| | |
|
| |
| |
| |
| | |
This is to get activerecord-deprecated_finders work again
|
| |
| |
| |
| | |
It is need in activerecord-deprecated_finders
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
to the class.
|
| | |
|
|/ |
|
|
|
|
|
| |
`configure_dependency` actually defined callbacks, so rename the method
and move it to the appropriate method.
|
| |
|
| |
|
|
|
|
|
|
| |
Well, not all of them, but some of them.
I don't think there's much reason for these methods to be private.
|
| |
|
|
|
|
|
| |
We don't need the complexity of to_sentence, and it shouldn't be a bang
method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's not really a good idea to have this as a global config option. We
should allow people to specify the behaviour per association.
There will now be two new values:
* :dependent => :restrict_with_exception implements the current
behaviour of :restrict. :restrict itself is deprecated in favour of
:restrict_with_exception.
* :dependent => :restrict_with_error implements the new behaviour - it
adds an error to the owner if there are dependent records present
See #4727 for the original discussion of this.
|
| |
|
|
|
|
|
|
| |
Move the logic for validation check to the same method, and cache
dependent option in a variable to reuse inside the dependency
configuration methods instead of relying on the options hash.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
This change uses Module.redefine_method as defined in ActiveSupport.
Making Module.define_method public would be as clean in the code, and
would also emit warnings when redefining an association. That is pretty
messy given current tests, so I'm leaving it for someone else to decide
what approach is better.
|
|
|
|
|
|
|
|
|
|
| |
Instead of generating association methods directly in the model
class, they are generated in an anonymous module which
is then included in the model class. There is one such module
for each association. The only subtlety is that the
generated_attributes_methods module (from ActiveModel) must
be forced to be included before association methods are created
so that attribute methods will not shadow association methods.
|
|
|
|
|
|
| |
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.
It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
|
|
|
|
| |
suggestion!
|
|
|
|
| |
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
|
|
callbacks etc) rather than calling a whole bunch of methods with rather long names.
|