Commit Graph

566 Commits

Author SHA1 Message Date
Charlie Somerville
9a2d6cad23 backport rails 4 assign attributes 2013-09-17 15:50:09 +10:00
Charlie Somerville
eefc42630f restore 1.9.3 respond_to? behaviour when running on 1.9.3 2013-08-08 20:42:52 -07:00
Charlie Somerville
0b57366c77 use this hacky shit to emulate old behaviour of respond_to? 2013-08-08 20:37:30 -07:00
rick
46f1ddbff9 backport dynamic finder fix (CVE-2012-5664) 2013-01-02 15:02:25 -07:00
Justin Collins
a6eb61b7e4 Fix SQL injection via nested hashes in conditions 2012-06-12 23:14:10 -07:00
Vijay Dev
6c42c142e2 fix incorrect version in deprecation message
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-20 13:32:18 -02:00
Santiago Pastorino
a5d8c95a7c Changes the usage of Object#returning with Object#tap
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-25 22:49:06 +02:00
Neeraj Singh
99cdea7cbe update_attribute and updated_attributes! are now wrapped in a transaction
[#922 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-18 11:20:25 +02:00
Aaron Patterson
7b6383f263 fixing performance regression from 2.3.5 -> 2.3.8 2010-07-15 15:59:19 -07:00
David Trasbo
ac42e6951f Deprecate ActiveRecord::Base#class_name [#379 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:54:05 +02:00
Michael Koziarski
b760d699a8 Merge commit 'mislav/counter_cache_2-3-stable' into 2-3-stable 2010-05-29 14:05:31 +12:00
Santiago Pastorino
555801c908 The intention here was to assign to different objects ht: Radar 2010-05-08 23:34:07 +03:00
Santiago Pastorino
f967b352d2 Make find_or_create and find_or_initialize work mixing explicit parameters and a hash. ht: Marc-André Lafortune
[#4457 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-07 13:29:51 -07:00
Mislav Marohnić
8be3e09fcf fix reset_counters to work even with complex class names
e.g. it guesses that a belongs_to association to Namespace::MyModel is
named "my_model", unlike before where it would look up an association
named "namespace::mymodel" and fail.
2010-04-17 03:13:13 +02:00
Mislav Marohnić
ef0591efc2 cleanup update/reset_counters; refactor tests 2010-04-17 03:13:00 +02:00
Santiago Pastorino
958b0e977a fix stack trace lines on class_eval
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 22:06:51 +02:00
Andrew White
03d5d0b5f5 Add the ability to specify table_name_prefix on individual modules
[#4032 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-29 08:55:21 -07:00
Aaron Patterson
5a806f6759 converting inject to each and map
[#4119 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-06 20:32:19 -08:00
Tobias Bielohlawek
b06e5dce97 fixed a 'RecordNotFound' bug when calling 'reload' on a object which doesn't met the default_scope conditions, added test [#3166 status:resolved]
The reload method didn't made use of 'with_exclusive_scope' when reloading the object. This lead to a RecordNotFound exception, in case the object doesn't met the default_scope condition (anymore) - which is obviously a bug. This quick fix makes use of with_exclusive_scope in the reload method as well. See test for full example.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-02-26 11:39:15 +01:00
Stefan Penner
c362a76d00 Fixed multiparameter attribute assignment bug RE: Ticket 3131
http://rails.lighthouseapp.com/projects/8994/tickets/3131-multiparamter_attribute-assignment-fails-when-used-via-assoication
2010-01-02 23:48:09 -08:00
Gabe da Silveira
43d2cb8e93 Replace reset_counter_cache with reset_counters that has API inline with existing update_counters method
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-03 23:25:41 -08:00
Mike Breen
1db3a27961 Implement ActiveRecord#reset_counter_cache
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-02 12:08:57 -08:00
Lance Ivy
7c1e4ef64b Don't cascade autosave validation to destroyed children. [#2761 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 13:16:30 +02:00
Tristan Dunn
491f1b5f36 Prevent overwriting of table name in merging SQL conditions [#2949 state:resolved] 2009-08-10 00:41:53 +01:00
Arthur Zapparoli
18b4ac6992 Model#human_attribute_name now accept symbols [#3025 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 23:56:18 +01:00
Vladimir Meremyanin
93f5d9d5f0 Make sure association conditions work with :include and :joins [#358 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:10:34 +01:00
Hugo Peixoto
2c4f4a8734 With multiparameter date attributes, the behaviour when empty fields are present is now coherent with the one described in the date_select documentation.
[#1715 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 13:39:31 -07:00
Michael Koziarski
19c38a9b70 Whitelist the methods which are called by multiparameter attribute assignment.
This prevents users from causing NoMethodErrors and the like by editing the parameter names, and closes a potential exploit of CVE-2009-1904.
2009-06-10 12:11:18 +12:00
Pratik Naik
97b75c9f16 Make sure default_scope#create checks for options[:conditions] [#2181 state:resolved] [James Le Cuirot] 2009-05-18 21:27:55 +02:00
Peter Marklund
0380e9ca5f Changed ActiveRecord::Base#exists? to invoke find_initial so that it is compatible with, and doesn't lose, :include scopes (references to eager loaded tables)
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2543 state:committed]
2009-05-14 20:42:13 +12:00
Pratik Naik
375e8976e3 Ensure JoinAssociation uses aliased table name when multiple associations have hash conditions on the same table 2009-04-20 13:56:03 +01:00
Pratik Naik
18eb80ccc7 Merge docrails 2009-03-16 11:28:36 +00:00
Chris Kampmeier
3c64c9a575 Fix spelling of an internal method [#1734 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-12 15:41:31 +00:00
Jeremy Kemper
19ad375e7a Don't duplicate :order from scope and options, it makes mysql do extra work 2009-03-10 23:11:05 -07:00
Manfred Stienstra
c3aa2bcdcf Ensure nested with_scope merges conditions inside out [#2193 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-10 11:49:58 +00:00
Rob Anderton
faf4ba6b79 Allow find(:last) :order be a symbol [#2024 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 12:52:14 +00:00
Jan De Poorter
277c799d58 Fix find_by_last when order is given [#2127 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-03-09 13:02:31 +01:00
Will Bryant
7fb7b48a1f Allow :having conditions to be sanitized like regular :condition. [#2158 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 22:29:53 +00:00
Pratik Naik
4863634a15 Ensure supplie :from has precedence over scoped :from [#1370 state:resolved] 2009-03-06 18:36:30 +00:00
Mike Gunderloy
c653f700d3 Fix that scoped find with :group and :having [#2006 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-02-28 17:35:58 +00:00
Pratik Naik
53cd102b39 Merge with docrails 2009-02-24 12:29:25 +00:00
David Heinemeier Hansson
d13623ca46 Added ActiveRecord::Base.each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck] 2009-02-23 12:11:02 +01:00
Will Bryant
9991868d85 support end-exclusive ... Ranges in SQL hash condition sanitization properly
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1865 state:committed]
2009-02-06 13:43:02 +13:00
Scott Taylor
5a8f764661 Add ActiveRecord::Base.exists? with no args [#1817 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-02-05 20:51:06 +01:00
Eloy Duran
ec8f045844 Add support for nested object forms to ActiveRecord and the helpers in ActionPack
Signed-Off-By: Michael Koziarski <michael@koziarski.com>

[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Filip H.F. "FiXato" Slagter
a0d8202bb9 Ensure whitespaces are stripped when merging string joins. [#1297 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-01-28 19:50:55 +00:00
Pratik Naik
74871961ec Add array id support to Model.update_counters. [#1254 state:resolved] [Carlos Júnior] 2009-01-28 19:20:55 +00:00
Pratik Naik
fe6ffce51d Make sure inner scope conditions get a preference over the outer ones 2009-01-24 17:54:10 +00:00
Pratik Naik
39e1ac658e Merge docrails 2009-01-18 18:10:58 +00:00
David Heinemeier Hansson
0efec64520 Merge branch 'master' of git@github.com:rails/rails 2008-12-28 20:53:58 +01:00