Commit Graph

304 Commits

Author SHA1 Message Date
Aaron Patterson
b53ffb35e0 stop using deprecated methods in arel 2011-04-11 15:50:05 -07:00
Emilio Tagua
b35617235d Use IM when trying to load records using ID.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-04 10:48:12 +02:00
Aaron Patterson
0471fc9f1c Merge branch 'master' into zomg
* master: (51 commits)
  order is not guaranteed by this select, so add an order and call first!
  oracle stores this with microseconds, so convert to seconds before comparing
  make sure that active connections are not cleared during test when an exception happens
  clearing active connections in the ConnectionManagement middleware if an exception happens
  proxy body responses so we close database connections after body is flushed
  Pass the proper method_name instead of hardcoding to action_name.
  Quote find_in_batches ORDER BY clause [#6620 state:resolved]
  Delegate first!, last!, any? and many? to scoped
  Dont call authenticate_or_request_with_http_basic twice
  Remove 'warning: ambiguous first argument' when running ActionPack tests
  Change exists? so that it doesn't instantiate records [#6127 state:resolved]
  Move mapper_test to the appropriate location
  Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved]
  Fix examples
  Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH]
  make sure we have an active database connection before running each connection management test
  adding active_connections? to the connection pool for finding open connections
  adding active_connection? to the connection pool
  testing app delegation from the ConnectionManagement middleware
  namespacing connection management tests. ❤️
  ...
2011-03-29 17:38:43 -07:00
Andrew White
555d016389 Quote find_in_batches ORDER BY clause [#6620 state:resolved] 2011-03-29 17:24:55 +01:00
Andrew White
b155fdadf3 Change exists? so that it doesn't instantiate records [#6127 state:resolved] 2011-03-29 12:51:58 +01:00
Sebastian Martinez
fb21511040 Bring #reorder back
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-28 10:24:08 -03:00
Xavier Noria
9d9b873b95 removes unnecessary selfs, and mentions that first! and last! take no arguments in their API docs 2011-03-26 00:02:40 +01:00
Pratik Naik
25be204e3c No arguments for first! and last! 2011-03-25 22:30:36 +00:00
Josh Susser
65dce01091 comment typo fix 2011-03-25 12:28:37 -07:00
John Mileham
28c73f0123 Use Arel to build subquery. Adapt tests to changed fixtures. 2011-03-24 15:09:24 -04:00
John Mileham
b44a0ec153 Merge branch 'master' of github.com:rails/rails into count_behavior 2011-03-24 15:03:08 -04:00
Josh Susser
5214e73850 add #first! and #last! to models & relations 2011-03-24 09:55:51 -07:00
Aaron Patterson
2ef6270f8f Merge branch 'master' into fuuu
* master:
  Do not show optional (.:format) block for wildcard route [#6605 state:resolved]
  pushing id insertion and prefetch primary keys down to Relation#insert
  use prepared statements to fetch the last insert id
  escaping binary data encoding when inserting to sqlite3. Thanks Naruse! [#6559 state:resolved]
  schemas set by set_table_name are respected by the mysql adapter. [#5322 state:resolved]
  Reapply extensions when using except and only
  SJIS is an alias to Windows-31J in ruby trunk. Use SHIFT_JIS for this test
  Improved resolver docs a bit
  [action_view] docs for FileSystemResolver
  [action_view] added custom patterns to template resolver
2011-03-22 09:34:33 -07:00
Iain Hecker
96b9fc4400 Reapply extensions when using except and only 2011-03-21 10:29:45 -07:00
Jon Leighton
02a43f9f45 Resolve some TODO comments which I decided did not need anything done 2011-03-12 08:42:57 +00:00
Jon Leighton
28ed10d3f2 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
2011-03-05 22:58:48 +00:00
Aaron Patterson
74818a3543 use Arel::Table#alias rather than passing the :as parameter 2011-03-05 11:56:24 -08:00
Jon Leighton
735844db71 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
	activerecord/lib/active_record/associations/has_many_association.rb
	activerecord/lib/active_record/associations/has_many_through_association.rb
	activerecord/lib/active_record/associations/has_one_association.rb
	activerecord/lib/active_record/associations/has_one_through_association.rb
	activerecord/lib/active_record/associations/through_association_scope.rb
	activerecord/lib/active_record/reflection.rb
	activerecord/test/cases/associations/has_many_through_associations_test.rb
	activerecord/test/cases/associations/has_one_through_associations_test.rb
	activerecord/test/cases/reflection_test.rb
	activerecord/test/cases/relations_test.rb
	activerecord/test/fixtures/memberships.yml
	activerecord/test/models/categorization.rb
	activerecord/test/models/category.rb
	activerecord/test/models/member.rb
	activerecord/test/models/reference.rb
	activerecord/test/models/tagging.rb
2011-03-04 09:30:27 +00:00
John Mileham
d5994ee48a Change behavior of count(:limit => x, :offset => y) to limit/offset before counting. 2011-03-03 23:26:45 -05:00
Jon Leighton
b171b9e73d Move JoinDependency and friends from ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations 2011-02-28 22:12:43 +00:00
Aaron Patterson
f3e9cbc695 use an attribute rather than a SQL literal 2011-02-26 16:05:15 -08:00
Aaron Patterson
54a2bf6601 removing limits and offsets from COUNT queries unless both are specified. [#6268 state:resolved] 2011-02-25 15:38:59 -08:00
Xavier Noria
f41bf6938f merges docrails 2011-02-18 23:22:15 +01:00
Nicholas Rowe
9a9d895481 Fix Typos: remove several occurences of the the 2011-02-17 20:46:52 -05:00
Jon Leighton
1644663ba7 Split AssociationProxy into an Association class (and subclasses) which manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more. 2011-02-18 00:00:13 +00:00
Aaron Patterson
9c023cc4d2 explicitly allowing lolqueries 2011-02-16 15:11:48 -08:00
Aaron Patterson
ceb2f0f216 use the arel table rather than generating strings 2011-02-16 11:46:55 -08:00
Aaron Patterson
1dea7b5a61 no need for Array.wrap 2011-02-16 11:22:30 -08:00
Steven Fenigstein
9b188c5bfe removed an unnecessary second query when passing an ActiveRecord::Relation to a where clause. And added ability to use subselects in where clauses. 2011-02-16 09:54:09 -08:00
Ernie Miller
fbd917f50a Remove Relation#& alias for Relation#merge 2011-02-12 17:23:19 -08:00
Aaron Patterson
0b58a7ff42 limit() should sanitize limit values
This fixes CVE-2011-0448
2011-02-08 14:21:12 -08:00
Xavier Noria
8b5dc9caa5 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-05 19:47:08 +01:00
Gabriel Horner
ac15647bf0 keep options titles consistent to "Options" 2011-02-03 23:51:06 -05:00
Ken Collins
95d5d9b6c4 The type_cast_calculated_value method will trust DB types before casting to a BigDecimal.
[#6365 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 20:00:51 -02:00
Xavier Noria
236f1f52cd Merge branch 'master' of git://github.com/lifo/docrails 2011-01-20 10:33:38 +01:00
Jordi Romero
b31ef7ee83 document ActiveRecord's except and only
Document methods that allow easily override arel queries
2011-01-15 01:17:53 +01:00
Raimonds Simanovskis
f4f4964ce0 Always return decimal average of integer fields
In previous version if database adapter (e.g. SQLite and Oracle) returned non-String calculated values then type_cast_using_column converted decimal average value of intefer field to integer value. Now operation parameter is always checked to decide which conversion of calculated value should be done.
2011-01-10 15:51:32 -08:00
Aaron Patterson
3b677aa006 use select_all because not all database adapters support bind values 2011-01-08 19:59:31 -08:00
Aaron Patterson
36d7bd1898 stop creating intermediate AR objects, just construct AR objects from a list of hashes 2011-01-07 18:45:17 -08:00
Raimonds Simanovskis
9c1c551f25 Explicitly select * from has_and_belongs_to_many association tables, simplify exists? query
Previous version (after commit 3103296a61) was generating wrong SQL for Oracle when calling exists? method on HABTM association.
2011-01-04 17:06:33 +02:00
Jon Leighton
2120da7f73 ActiveRecord::Relation#primary_key should return a string, just like ActiveRecord::Base.primary_key does. 2011-01-03 16:24:32 -08:00
Jon Leighton
1313d386da Make Relation#create_with always merge rather than overwrite, not just when merging two relations. If you wish to overwrite, you can do relation.create_with(nil), or for a specific attribute, relation.create_with(:attr => nil). 2011-01-03 16:24:32 -08:00
Jon Leighton
3103296a61 Let AssociationCollection#find use #scoped to do its finding. Note that I am removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences. 2011-01-03 16:24:31 -08:00
Robert Pankowecki (Gavdi)
b9ce3419e5 User id instead of quoted_id to prevent double quoting. Fixes failing test for bug #6036. 2011-01-04 01:21:26 +08:00
Jon Leighton
1267598881 Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key 2010-12-31 20:00:45 +00:00
Jon Leighton
62b084f807 Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query. 2010-12-31 20:00:44 +00:00
Aaron Patterson
c7f81f14df arel can escape the id, so avoid using the database connection 2010-12-22 19:20:08 -08:00
Aaron Patterson
83ffb82fb9 Arel::Table#[] always returns an attribute, so no need for || 2010-12-22 19:17:44 -08:00
Aaron Patterson
2de9b858a0 to_sym stuff before passing it to arel 2010-12-22 18:23:37 -08:00
Piotr Sarnacki
40b15f9f38 ActiveRecord::Base.joins should allow single nil argument [#6181 state:resolved] 2010-12-16 22:25:09 +01:00