aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/company.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move association definition to the model fileAkira Matsuda2014-08-281-0/+1
|
* Add AR::Base.to_param for convenient "pretty" URLs derived from a model's ↵Javan Makhmali2013-11-141-0/+2
| | | | attribute or method.
* Port test from cf1904f to avoid future regressionPrem Sichanugrist2013-10-031-0/+5
| | | | Related issue: #11939, #12084
* Make sure inverse_of is visible on the has_many callbacksArthur Neves2013-09-251-1/+5
|
* More unused associations in AR test modelsAkira Matsuda2013-09-101-2/+0
|
* Revert "Merge branch 'master' of github.com:rails/docrails"Vijay Dev2013-08-171-0/+2
| | | | | | | This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake.
* More unused associations in AR test modelsAkira Matsuda2013-07-251-2/+0
|
* Dropped deprecated option `:restrict` for `:dependent` in associationsNeeraj Singh2013-07-031-7/+0
|
* Removed support for deprecated `finder_sql` in associations.Neeraj Singh2013-07-021-4/+0
|
* Removed support for deprecated `counter_sql`Neeraj Singh2013-07-021-16/+1
|
* Ambiguous reflections are on :through relationships are no longer supported.Aaron Patterson2013-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, you need to change this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end To this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts, :source => :tagging end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end
* Handle aliased attributes in ActiveRecord::Relation.Godfrey Chan2013-05-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When using symbol keys, ActiveRecord will now translate aliased attribute names to the actual column name used in the database: With the model class Topic alias_attribute :heading, :title end The call Topic.where(heading: 'The First Topic') should yield the same result as Topic.where(title: 'The First Topic') This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`. This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`. Github #7839 *Godfrey Chan*
* Added STI support to init and building associationsJason Rush2012-11-291-0/+1
| | | | | | | | Allows you to do BaseClass.new(:type => "SubClass") as well as parent.children.build(:type => "SubClass") or parent.build_child to initialize an STI subclass. Ensures that the class name is a valid class and that it is in the ancestors of the super class that the association is expecting.
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-1/+0
|
* test cleanup, remove ruby_type because it's no longer neededYves Senn2012-09-031-4/+0
| | | | | All tests with a custom inheritance_column use the `Vegtable` model. The field ruby_type on the Company models is no longer needed
* Remove the dependent_restrict_raises option.Jon Leighton2012-08-101-2/+14
| | | | | | | | | | | | | | | 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.
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-011-16/+20
|
* Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-011-1/+14
| | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
* Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-201-14/+1
|
* Convert association macros to the new syntaxJon Leighton2012-07-201-27/+27
|
* Fix issue with private kernel methods and collection associations. Closes #2508Carlos Antonio da Silva2012-05-021-0/+5
| | | | | | | | Change CollectionProxy#method_missing to use scoped.public_send, to avoid a problem described in issue #2508 when trying to use class methods with names like "open", that clash with private kernel methods. Also changed the dynamic matcher instantiator to send straight to scoped, to avoid another roundtrip to method_missing.
* test_get_ids_for_ordered_association fixedgregolsen2012-01-311-1/+1
|
* ids_reader method fixed, test added to has_many associationgregolsen2012-01-311-0/+1
|
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-0/+2
| | | | | | See the CHANGELOG for details. Fixes #950.
* Deprecate set_sequence_name in favour of self.sequence_name=Jon Leighton2011-11-291-1/+1
|
* Allow the :class_name option for associations to take a symbol.Jon Leighton2011-11-041-0/+1
| | | | | This is to avoid confusing newbies, and to be consistent with the fact that other options like :foreign_key already allow a symbol or a string.
* Refactor tests to be less brittleJon Leighton2011-06-121-0/+12
|
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-9/+6
| | | | ... } rather than instance_eval-ing strings
* belongs_to records should be initialized within the association scopeJon Leighton2011-01-161-0/+1
|
* Add create_association! for belongs_toJon Leighton2011-01-161-0/+1
|
* Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-1/+0
| | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
* Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-0/+1
| | | | | | | | | | state:resolved] This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message!
* Verify that when has_many associated objects are destroyed via :dependent => ↵Jon Leighton2010-12-311-1/+16
| | | | :destroy, when the parent is destroyed, the callbacks are run
* Convert :primary_key in association to a string before comparing to column ↵Denis Odorcic2010-10-301-0/+1
| | | | names, so that for example :primary_key => :another_pk works as well [#5605 state:resolved]
* Add :dependent = to has_one and has_many [#3075 state:resolved]Rizwan Reza2010-03-281-0/+5
|
* Fix associations to call :destroy or :delete based on the right :dependent ↵Carlos Antonio da Silva2010-03-091-2/+2
| | | | | | option Signed-off-by: José Valim <jose.valim@gmail.com>
* Simplify calculation scope building. Remove :order from associations as it ↵Pratik Naik2010-01-181-5/+3
| | | | is troublesome w/ calculation methods using postgresql.
* delete correct records for a has_many with :primary_key and :dependent => ↵Matt Jones2009-11-101-0/+2
| | | | | | :delete_all Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Make has_one with :conditions hash scope build or creation of the associated ↵Luciano G Panaro2009-09-281-0/+2
| | | | | | | object with those conditions Signed-off-by: Michael Koziarski <michael@koziarski.com> [#3088 state:committed]
* Fix has_one with foreign_key and primary_key association bug which caused ↵Graeme Porteous2009-09-121-0/+1
| | | | | | | | the associated object being lost when saving the owner. [#1756 state:resolved] Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Explicitely setting `autosave => false' should override new_record ↵Eloy Duran2009-09-121-0/+5
| | | | | | autosaving. [#2214 state:resolved] Original author is Jacob.
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-0/+5
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* has_many :through create should not raise validation errorsrailsbob2009-08-091-0/+2
| | | | | | [#2934 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* added :order option to find :first methods and associations as otherwise ↵Raimonds Simanovskis2009-08-061-2/+6
| | | | | | | | Oracle tests were failing Oracle stores '' string as NULL Oracle cannot have identifiers larger than 30 characters added missing fixtures to test setup method
* Add primary_key option to belongs_to associationSzymon Nowak2009-07-151-0/+1
| | | | | | [#765 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-0/+4
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-4/+0
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-0/+4
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Merge branch 'master' into active_modelPratik Naik2009-04-221-7/+6
|\ | | | | | | | | Conflicts: activeresource/lib/active_resource/validations.rb
| * Ensure :dependent => :delete_all works for association with hash conditionsPratik Naik2009-04-201-7/+6
| |