aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/builder/singular_association.rb
Commit message (Collapse)AuthorAgeFilesLines
* Require `belongs_to` by default.Josef Šimánek2015-02-211-7/+0
| | | | Deprecate `required` option in favor of `optional` for belongs_to.
* Provide a better error message on :required associationHenrik Nygren2015-01-281-1/+1
| | | | Fixes #18696.
* Remove support to activerecord-deprecated_findersRafael Mendonça França2015-01-021-1/+1
|
* Remove unused 1:1 association :remote optionChris Griego2014-07-161-1/+1
| | | This option is unused, left over from pre-1.0 Rails to internally distinguish the location of the foreign key.
* Add a `required` option to singular associationsSean Griffin2014-07-041-1/+8
| | | | | | | | | | | | | | | | | | | | | | In addition to defining the association, a `required` association will also have its presence validated. Before: ```ruby belongs_to :account validates_presence_of :account ``` After: ```ruby belongs_to :account, required: true ``` This helps to draw a distinction between types of validations, since validations on associations are generally for data integrity purposes, and aren't usually set through form inputs.
* Revert the whole refactoring in the association builder classes.Rafael Mendonça França2013-12-111-1/+1
| | | | 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
* Raise `ArgumentError` when `has_one` is used with `counter_cache`Godfrey Chan2013-11-291-1/+1
| | | | | | | | | Previously, the `has_one` macro incorrectly accepts the `counter_cache` option due to a bug, although that options was never supported nor functional on `has_one` and `has_one ... through` relationships. It now correctly raises an `ArgumentError` when passed that option. For reference, this bug was introduced in 52f8e4b9.
* Merge pull request #12390 from kennyj/rename_to_association_methodsRafael Mendonça França2013-11-051-1/+1
|\ | | | | | | | | | | | | | | | | Renamed generated_feature_methods to generated_association_methods. Conflicts: activerecord/lib/active_record/associations/builder/association.rb activerecord/lib/active_record/associations/builder/singular_association.rb activerecord/test/cases/base_test.rb
| * Renamed generated_feature_methods to generated_association_methods.kennyj2013-09-281-1/+1
| |
* | Make valid_options a class methodRafael Mendonça França2013-10-091-1/+1
| |
* | :scissors:Rafael Mendonça França2013-10-091-1/+1
| |
* | Push define_accessors to class level since we don't need anythig fromRafael Mendonça França2013-10-081-2/+2
| | | | | | | | the instance
* | Use the reflection name instead of the accessorRafael Mendonça França2013-10-081-1/+1
| |
* | Move define_constructors to class levelRafael Mendonça França2013-10-081-3/+2
| |
* | push constructable? on to the reflectionAaron Patterson2013-10-021-6/+2
|/
* make mutation method apis more consistentAaron Patterson2013-08-011-2/+2
|
* pass the mixin in to the code generation methodsAaron Patterson2013-07-311-3/+3
|
* extract mutation from generation methodAaron Patterson2013-07-231-1/+1
|
* Getting rid of the +automatic_inverse_of: false+ option in associations in favorwangjohn2013-06-081-1/+1
| | | | | of using +inverse_of: false+ option. Changing the documentation and adding a CHANGELOG entry for the automatic inverse detection feature.
* Added some more documentation for define_readers and define_writer of the ↵aditya-kapoor2013-05-151-0/+4
| | | | Association and its inherited classes
* Created a method to automatically find inverse associations and cachewangjohn2013-05-071-1/+1
| | | | | | the results. Added tests to check to make sure that inverse associations are automatically found when has_many, has_one, or belongs_to associations are defined.
* Use method compilation for association methodsJon Leighton2012-08-101-11/+11
| | | | | | | | | Method compilation provides better performance and I think the code comes out cleaner as well. A knock on effect is that methods that get redefined produce warnings. I think this is a good thing. I had to deal with a bunch of warnings coming from our tests, though.
* Unprivatise all the thingsJon Leighton2012-08-101-13/+11
| | | | | | Well, not all of them, but some of them. I don't think there's much reason for these methods to be private.
* stop using class_attribute where methods/inheritance will suffice.Jon Leighton2012-07-131-1/+3
|
* avoid warningsJosh Susser2011-11-271-3/+3
| | | | | | | 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-3/+3
| | | | | | | | | | 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.
* removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-251-13/+0
|
* Add block setting of attributes to singular associationsAndrew White2011-05-171-6/+6
|
* Bring back obj.association_loaded? as a deprecated method. Fixes #472.Jon Leighton2011-05-111-0/+13
|
* Use proper objects to do the work to build the associations (adding methods, ↵Jon Leighton2011-02-211-0/+32
callbacks etc) rather than calling a whole bunch of methods with rather long names.