Aaron Patterson
74818a3543
use Arel::Table#alias rather than passing the :as parameter
2011-03-05 11:56:24 -08: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
Aaron Patterson
4cd3302279
make sure that join nodes are uniq
2010-12-16 01:49:30 +05:30
Aaron Patterson
18402b5d64
supporting arel AST nodes when building join statements
2010-12-16 01:49:29 +05:30
Aaron Patterson
b68407f7f0
bucketing based on join type
2010-12-16 01:49:29 +05:30
Aaron Patterson
c02fd2acc5
taking advantage of the JoinSource node in the SQL AST
2010-12-16 01:49:29 +05:30
Aaron Patterson
0042054ea8
remove lasgn since AST is mutated
2010-12-16 01:49:27 +05:30
Aaron Patterson
cea73f82ad
just mutate the ast, fewer lasgns
2010-12-16 01:49:27 +05:30
Aaron Patterson
7d8fd57236
no more manager manipulation if there is no custom join ast
2010-12-10 11:38:43 -08:00
Aaron Patterson
ec72b6b3ec
froms should never equal 0
2010-12-10 11:38:43 -08:00
Aaron Patterson
4dec00a9d8
manager will always be a manager
2010-12-10 11:38:43 -08:00
Aaron Patterson
82944b95a9
eliminate lasgns
2010-12-10 11:38:42 -08:00
Aaron Patterson
88bc49f2f7
dealing with an AST manager, not a relation, so fix the variable names
2010-12-10 11:38:42 -08:00
Aaron Patterson
17d72dd19f
adding a fixme comment
2010-12-08 11:02:15 -08:00
Aaron Patterson
3499f882cc
renaming variables, making the join_ast method private
2010-12-08 10:54:24 -08:00
Aaron Patterson
ddd6dee043
further reducing dependence on custom_joins
2010-12-08 10:35:26 -08:00
Aaron Patterson
2fd385d471
reducing use of custom joins
2010-12-08 10:29:52 -08:00
Aaron Patterson
1d96d44da3
passing the ast to a table when the relation is a table
2010-12-07 18:54:04 -08:00
Aaron Patterson
d98cb5153d
JoinDependency is always created with an AST now
2010-12-07 17:05:15 -08:00
Aaron Patterson
2d9d6cd4c2
passing the ast to JoinDependency
2010-12-07 16:48:59 -08:00