aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/builder/has_one.rb
Commit message (Collapse)AuthorAgeFilesLines
* Adds touch option to has_one associationAbhay Nikam2019-04-251-2/+34
|
* Make association builder methods privateRyuta Kamizono2019-04-241-0/+2
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Define `:foreign_type` as a valid option in `SingularAssociation`yui-knk2016-01-191-1/+1
| | | | | `:foreign_type` is a valid option for `belongs_to` and `has_one` so remove this to `SingularAssociation`.
* docs, add missing `:nodoc: for `Associations::Builder`. [ci skip]Yves Senn2015-10-131-1/+1
| | | | | | 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.
* Require `belongs_to` by default.Josef Šimánek2015-02-211-0/+7
| | | | Deprecate `required` option in favor of `optional` for belongs_to.
* Remove support to activerecord-deprecated_findersRafael Mendonça França2015-01-021-4/+2
|
* Add foreign_type option for polymorphic has_one and has_many.Ulisses Almeida + Kassio Borges2014-12-081-1/+1
| | | | | | | 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.
* Merge pull request #12450 from iantropov/masterRafael Mendonça França2014-06-271-1/+1
|\ | | | | | | | | | | | | | | | | 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
| * Fix bug, when ':dependent => :destroy' option violates foreign key ↵Ivan Antropov2013-10-261-3/+3
| | | | | | | | constraints, issue #12380
* | Remove a long gone :order option from has_one's valid_options.thedarkone2014-06-091-1/+1
| |
* | Revert the whole refactoring in the association builder classes.Rafael Mendonça França2013-12-111-2/+4
| | | | | | | | This is to get activerecord-deprecated_finders work again
* | Bring back the valid_options class accessorRafael Mendonça França2013-12-111-1/+1
| | | | | | | | It is need in activerecord-deprecated_finders
* | Method visibility will not make difference hereRafael Mendonça França2013-10-091-2/+0
| |
* | Move macro to class levelRafael Mendonça França2013-10-091-1/+1
| |
* | Make valid_options a class methodRafael Mendonça França2013-10-091-1/+1
| |
* | add_before_destroy_callbacks doesn't depend on the instance, so push itAaron Patterson2013-10-021-1/+1
| | | | | | | | to the class.
* | valid_options doesn't depend on the instance, so push it to the classAaron Patterson2013-10-021-3/+3
| |
* | push constructable? on to the reflectionAaron Patterson2013-10-021-4/+0
|/
* push more mutations out of the builderAaron Patterson2013-08-011-4/+6
| | | | | `configure_dependency` actually defined callbacks, so rename the method and move it to the appropriate method.
* Dropped deprecated option `:restrict` for `:dependent` in associationsNeeraj Singh2013-07-031-1/+1
|
* DRY up handling of dependent optionJon Leighton2012-08-101-19/+3
|
* Unprivatise all the thingsJon Leighton2012-08-101-14/+12
| | | | | | Well, not all of them, but some of them. I don't think there's much reason for these methods to be private.
* move dependency logic out of generated methodsJon Leighton2012-08-101-11/+7
|
* Clean up dependent option validation.Jon Leighton2012-08-101-2/+1
| | | | | We don't need the complexity of to_sentence, and it shouldn't be a bang method.
* Remove the dependent_restrict_raises option.Jon Leighton2012-08-101-2/+1
| | | | | | | | | | | | | | | 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.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Refactor dependency check validationCarlos Antonio da Silva2012-08-011-6/+4
| | | | | | 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.
* move method for dependent option checkHrvoje Šimić2012-08-011-4/+3
|
* stop using class_attribute where methods/inheritance will suffice.Jon Leighton2012-07-131-11/+8
|
* Same method for has_many and has_one associationsPaco Guzman2012-01-311-16/+2
|
* Easy dependent_restrict error messagePaco Guzman2012-01-311-2/+1
|
* has_many/has_one, :dependent => :restrict, deprecation added.Manoj2012-01-291-1/+10
|
* avoid warningsJosh Susser2011-11-271-2/+2
| | | | | | | 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.
* association methods are now generated in modulesJosh Susser2011-11-151-6/+5
| | | | | | | | | | 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.
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | 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?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+3
| | | | 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?.
* Use proper objects to do the work to build the associations (adding methods, ↵Jon Leighton2011-02-211-0/+61
callbacks etc) rather than calling a whole bunch of methods with rather long names.