aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | |
* | | Do not consider the numeric attribute as changed if the old value isRafael Mendonça França2012-08-021-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zero and the new value is not a string. Before this commit this was the behavior r = Review.find_by_issue(0) r.issue => 0 r.changes => {} r.issue = 0 => 0 r.changed? => true r.changes => {"issue"=>[0,0]} Fixes #7237 Conflicts: activerecord/CHANGELOG.md
* | | s/scoped/scope/Jon Leighton2012-08-011-1/+1
| | |
* | | Add CollectionProxy#scopeJon Leighton2012-08-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be used to get a Relation from an association. Previously we had a #scoped method, but we're deprecating that for AR::Base, so it doesn't make sense to have it here. This was requested by DHH, to facilitate code like this: Project.scope.order('created_at DESC').page(current_page).tagged_with(@tag).limit(5).scoping do @topics = @project.topics.scope @todolists = @project.todolists.scope @attachments = @project.attachments.scope @documents = @project.documents.scope end
* | | Add `Relation#load`Jon Leighton2012-08-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method explicitly loads the records and then returns `self`. Rather than deciding between "do I want an array or a relation?", most people are actually asking themselves "do I want to eager load or lazy load?" Therefore, this method provides a way to explicitly eager-load without having to switch from a `Relation` to an array. Example: @posts = Post.where(published: true).load
* | | Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-015-44/+85
| | |
* | | Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-016-3/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
* | | AR::Relation#order: make new order prepend old oneBogdan Gusiev2012-07-314-13/+13
| | | | | | | | | | | | | | | | | | | | | User.order("name asc").order("created_at desc") # SELECT * FROM users ORDER BY created_at desc, name asc This also affects order defined in `default_scope` or any kind of associations.
* | | Remove the deprecation of update_column.Rafael Mendonça França2012-07-301-38/+17
| | | | | | | | | | | | | | | | | | update_column was suggested as replacement of update_attribute at the last release of 3-2-stable, so deprecating it now will confuse the users.
* | | Merge pull request #7196 from ↵Aaron Patterson2012-07-291-1/+5
|\ \ \ | | | | | | | | | | | | | | | | rimidl/fix-incorrect-require-mysql-in-mysql_rake_test Fix incorrect usage `require mysql` in the activerecord/.../mysql_rake_test
| * | | fix incorrect usage `require mysql` in the ↵Vladimir Strakhov2012-07-291-1/+5
| | | | | | | | | | | | | | | | activerecord/test/.../mysql_rake_test.rb
* | | | More polite cleanup for sqlite testsBogdan Gusiev2012-07-291-4/+4
|/ / /
* | | Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-277-0/+435
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* | | Modity the :json_data_empty attribute from `:null => false` to `:null => true`Yasuo Honda2012-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | to address ORA-01400 errors with Oracle enhanced adapter. The original commit 3c0bf043 requires :json_data_empty attribute has empty string OR null, then setting `:default => ""` is enough.