aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* Add a test to make sure preloading properly merges association and default ↵Pratik Naik2012-08-283-0/+23
| | | | scope conditions
* Merge pull request #7458 from frodsan/fix_orddep_basicsRafael Mendonça França2012-08-281-5/+5
|\ | | | | fix order dependent test in AR::BasicsTest
| * fix order dependent test in AR::BasicsTestFrancesco Rodriguez2012-08-271-5/+5
| | | | | | | | | | | | | | | | This test https://github.com/rails/rails/blob/master/activerecord/test/cases/base_test.rb#L381 is failing because is not setting `CreditCard.pluralize_table_name` to `false`. In this case, i prefer to change to another model that is not in the `GUESSED_CLASSES` array.
* | ensures that the test repairs the validation setupFrancesco Rodriguez2012-08-271-7/+9
|/
* fix order dependent test in AggregationsTestFrancesco Rodriguez2012-08-261-0/+2
| | | | | | | | | | | | | | Ensure class variable is set to nil. It prevents the following test to fail: def test_do_not_run_the_converter_when_nil_was_set customers(:david).non_blank_gps_location = nil assert_nil Customer.gps_conversion_was_run end Check https://github.com/rails/rails/blob/master/activerecord/test/models/customer.rb#L7 for more information.
* Add test to ensure that save will raise SerializationTypeMismatch if theRafael Mendonça França2012-08-261-0/+6
| | | | serialized attribute value is not from the same class
* We don't need this reloadRafael Mendonça França2012-08-261-1/+1
|
* Use the Topic class in the attribute serialized testsRafael Mendonça França2012-08-261-8/+4
|
* Use teardown hook to return the initial state of the objectRafael Mendonça França2012-08-261-16/+5
|
* Move the serialized attribute tests to their own fileRafael Mendonça França2012-08-263-207/+214
|
* Move test to the correct fileRafael Mendonça França2012-08-263-12/+12
|
* Revert "Remove update_attribute."Rafael Mendonça França2012-08-252-1/+51
| | | | | | | | | | | This reverts commit a7f4b0a1231bf3c65db2ad4066da78c3da5ffb01. Conflicts: activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/persistence.rb activerecord/test/cases/base_test.rb activerecord/test/cases/dirty_test.rb activerecord/test/cases/timestamp_test.rb
* allow to pass Symbol or Proc into :limit option of ↵Mikhail Dieterle2012-08-262-8/+32
| | | | #accepts_nested_attributes_for
* Extract ActiveRecord::SessionStore from RailsPrem Sichanugrist2012-08-242-156/+0
| | | | | This functionality will be available from gem `active_record-session_store` instead.
* Model.select takes a variable list of arguments.Isaac Sanders2012-08-231-0/+8
| | | | | | This is a cleaner version of #6916. Closes #3165.
* Merge pull request #6606 from amatsuda/ar_relation_model_methodRafael Mendonça França2012-08-211-0/+5
|\ | | | | AR::Relation#model would be a better API than AR::Relation#klass
| * AR::Relation#model would be a better API than AR::Relation#klassAkira Matsuda2012-06-031-0/+5
| |
* | Use a model without counter cache to test read-only attributesRafael Mendonça França2012-08-211-9/+10
| |
* | reset_counters() was crashing when there were multiple belongs_to ↵Dave Desrochers2012-08-216-1/+29
| | | | | | | | | | | | associations with the same foreign key. This closes #5200.
* | Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_modeYasuo Honda2012-08-222-6/+8
| | | | | | | | | | | | | | | | | | Reason since MySQL 5.6.6-m9 the `sql_mode` default value is `NO_ENGINE_SUBSTITUTION`. This default parameter change is out of control from Rails. This test verifies Rails not overriding the default `@@GLOBAL.sql_mode` value by checking if `@@GLOBAL.sql_mode` is the same as `@@SESSION.sql_mode`.
* | Use instance_accessor: false instead of instance_writer.kennyj2012-08-213-7/+11
| |
* | Round usec when writing timestamp attribute.kennyj2012-08-211-0/+15
| |
* | removing dead codeAaron Patterson2012-08-201-19/+7
| |
* | define singleton methods rather than adding and removing methodsAaron Patterson2012-08-201-45/+32
| |
* | remove dead codeAaron Patterson2012-08-201-78/+36
| |
* | Fix "last equality wins" logic in relation mergeErnie Miller2012-08-191-4/+7
| | | | | | | | | | | | This is a real fix (as compared to the band-aid in b127d86c), which uses the recently-added equality methods for ARel nodes. It has the side benefit of simplifying the merge code a bit.
* | Merge pull request #7377 from ↵Carlos Antonio da Silva2012-08-181-0/+6
|\ \ | | | | | | | | | | | | brainopia/use_inversed_parent_for_first_and_last_child Use inversed parent for first and last child of has_many association
| * | Use inversed parent for first and last child of has_many associationbrainopia2012-08-181-0/+6
| | |
* | | Refactor missing parameter validation based on positionCarlos Antonio da Silva2012-08-181-1/+0
|/ /
* | Merge pull request #7380 from ↵Aaron Patterson2012-08-171-0/+16
|\ \ | | | | | | | | | | | | ernie/fix-nomethoderror-on-non-attribute-equalities Fix merge error when Equality LHS is non-attribute
| * | Fix merge error when Equality LHS is non-attributeErnie Miller2012-08-171-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is at best a band-aid for a more proper fix, since it won't truly handle the removal of the previous equality condition of these other nodes. I'm planning to put in some work on ARel toward supporting that goal. Related: rails/arel#130, ernie/squeel#153, ernie/squeel#156
* | | column default extraction should handle newlines.Aaron Patterson2012-08-171-0/+8
| | | | | | | | | | | | Fixes #7374
* | | Merge pull request #7352 from aripollak/microsecond-timestampRafael Mendonça França2012-08-172-1/+2
|\ \ \ | |/ / |/| | Fix occasional microsecond conversion inaccuracy
| * | Fix occasional microsecond conversion inaccuracyAri Pollak2012-08-152-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::ConnectionAdapters::Column#microseconds did an unnecessary conversion to from Rational to float when calculating the integer number of microseconds. Some terminating decimal numbers in base10 are repeating decimal numbers in base2 (the format of float), and occasionally this causes a rounding error. Patch & explanation originally from Logan Bowers.
* | | Renaming active_record_deprecated_finders to activerecord-deprecated_findersJon Leighton2012-08-172-2/+2
|/ / | | | | | | For consistency with the other AR extension plugins we are creating.
* | Merge pull request #7133 from roshats/fix_update_all_with_blank_argumentCarlos Antonio da Silva2012-08-151-0/+4
|\ \ | | | | | | | | | Change Relation#update_all with blank argument to raise an ArgumentError instead of trying an update with empty fields.
| * | raise ArgumentError if list of attributes to change is empty in update_allRoman Shatsov2012-08-141-0/+4
| | |
* | | Restore state on create when ActiveRecord::RecordInvalid is raisedDave Yeu2012-08-111-0/+17
| | | | | | | | | | | | This fixes issue #3217.
* | | Use method compilation for association methodsJon Leighton2012-08-107-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Remove the dependent_restrict_raises option.Jon Leighton2012-08-104-72/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #7286 from kennyj/fix_7191Rafael Mendonça França2012-08-101-0/+13
|\ \ \ | | | | | | | | Fix #7191. Remove unnecessary transaction when assigning has_one associations.
| * | | Fix #7191. Remove unnecessary transaction when assigning has_one associations.kennyj2012-08-081-0/+13
| | | |
* | | | Fix only-once stub logic.Steve Jorgensen2012-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | Didn't fail the test because adapter#query happens to not call raw connection's #query, but don't want to count on that and have a fragile test.
* | | | Fix just-plain-wrongness of psql auto-reconnect test.Steve Jorgensen2012-08-071-8/+9
|/ / / | | | | | | | | | | | | | | | Full test requiring manual intervention was fine, but w/ simulated disconnect, assertion was backward & still passing. Was several kinds of wrong.
* | | removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-063-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* | | Make ActiveRecord::Model::DeprecationProxy work betterJon Leighton2012-08-031-3/+23
| | | | | | | | | | | | Closes #6600
* | | Remove ActiveRecord::Base.to_aJon Leighton2012-08-0315-60/+52
| | | | | | | | | | | | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* | | Allow Relation#merge to take a proc.Jon Leighton2012-08-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was requested by DHH to allow creating of one's own custom association macros. For example: module Commentable def has_many_comments(extra) has_many :comments, -> { where(:foo).merge(extra) } end end class Post < ActiveRecord::Base extend Commentable has_many_comments -> { where(:bar) } end
* | | load active_support/deprecation in active_support/railsXavier Noria2012-08-022-2/+1
| | |
* | | load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-024-4/+0
| | |