Commit Graph

272 Commits

Author SHA1 Message Date
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
Aaron Patterson
70ab450274 cleaning up custom_join_sql method 2010-12-07 14:01:37 -08:00
Aaron Patterson
d21f38aaa2 use the columns hash for primary key lookup 2010-12-03 15:33:59 -08:00
Aaron Patterson
542cb5c327 fix warnings, stop using global variables 2010-11-30 18:46:56 -08:00
Aaron Patterson
d51854a6be stop using splat args when we do not need them 2010-11-30 17:42:17 -08:00
Aaron Patterson
7408b6ec84 just grep the AST for OuterJoin nodes rather than converting the tree to SQL 2010-11-30 17:29:19 -08:00
Aaron Patterson
f1758525f9 reduce method calls on arel 2010-11-30 16:51:03 -08:00
Aaron Patterson
8998aea4b7 making relationship merge cheaper 2010-11-30 13:31:00 -08:00
Aaron Patterson
cdf6cf01cb use ARel rather than generate SQL strings 2010-11-24 13:55:55 -08:00
Aaron Patterson
d4b8d3bafa moving column_aliases to JoinDependency 2010-11-24 13:55:55 -08:00
Aaron Patterson
8e8fb8a429 just wrap as a sql literal 2010-11-23 14:42:55 -08:00
Neeraj Singh
d33dcba72d Do not send id for quoting twice if the primary key is string.
[#6022 state:resolved]
2010-11-23 14:33:00 -08:00
Aaron Patterson
dc320d5873 skip cloning if arguments are blank 2010-11-22 17:23:37 -08:00