Commit Graph

195 Commits

Author SHA1 Message Date
Jon Leighton
bf2779298b Disable active record marshalling tests on Ruby 1.8.7 on Travis CI, as they have been failing intermittently for a long while due to what appears to be a Ruby bug. If anyone has the skills/expertise/time to debug this, please speak to the Travis guys. 2011-09-06 11:45:20 +01:00
Arun Agrawal
8be13b5b55 require bcrypt to pass the test 2011-09-04 09:32:15 +05:30
Arun Agrawal
df01e2e48a Warning removed. 2011-09-03 16:13:43 +05:30
Raimonds Simanovskis
db41b634f0 Oracle adapter removes double quotes when quoting table and column names 2011-08-30 19:23:41 +03:00
Akira Matsuda
933120cdfe do not compute table names for abstract classes 2011-08-24 21:50:17 -07:00
Aaron Patterson
f9b642cb15 prevent sql injection attacks by escaping quotes in column names 2011-08-16 15:17:17 -07:00
Jon Leighton
2db0455be6 Work around for lolruby bug. (Read on for explanation.)
We were experiencing CI test failures, for example:

* 3-1-stable: http://travis-ci.org/#!/rails/rails/builds/79473/L407
* master: http://travis-ci.org/#!/rails/rails/builds/79507/L80

These failures only happened on 1.8.7-p352, and we were only able to
reproduce on the Travis CI VM worker. We even tried creating a new 32
bit Ubuntu VM and running the tests on that, and it all worked fine.

After some epic trial and error, we discovered that replacing the
following:

  fuu = Marshal.load(Marshal.dump(fuu))

with:

  marshalled = Marshal.dump(fuu)
  fuu = Marshal.load(marshalled)

seemed to prevent the failure.

We have NO IDEA why this is. If anyone has some great insight to
contribute then that is welcome. Otherwise, hopefully this will just
help us get the CI green again.

Many thanks to @joshk for help with sorting this out.
2011-08-13 14:02:41 +01:00
Jon Leighton
c202c10965 Fully marshal AR::Base objects. Fixes #2431. 2011-08-08 23:34:06 +01:00
Jon Leighton
dd944cbf58 Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
Conflicts:

	activerecord/lib/active_record/relation/finder_methods.rb
	activerecord/test/cases/adapter_test.rb
2011-08-08 23:33:31 +01:00
Santiago Pastorino
434bbb0efc Revert "Merge pull request #2194 from cldwalker/after_initialize"
This reverts commit 198300727d, reversing
changes made to ae65c0b7a4.
2011-07-23 20:49:42 -03:00
Gabriel Horner
06c6252b10 simplify and be more explicit about create and after_initialize tests 2011-07-22 20:14:49 -04:00
Les Fletcher
3dc5f71c17 fix after_initialize edge case (close #2074 and close #2175)
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-22 20:14:48 -04:00
Aaron Patterson
56fb7fc1b2 bigdecimal should be typecast to a float on sqlite3. fixes #2162 2011-07-20 10:45:16 -07:00
Evan Light
2cbac3c6f8 Closes #2065
Cache key was incorrectly using timezone-dependent record#updated_at when it should be using a timezone-independent value to generate the cache key
2011-07-15 22:11:03 -04:00
Damien Mathieu
f170045c59 comparing different classes returns nil 2011-06-28 11:47:37 -07:00
Damien Mathieu
c5b43afd6c allow comparison on model objects - Closes #1858 2011-06-28 11:47:32 -07:00
Aaron Patterson
e504101b36 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:46:50 -07:00
Jon Leighton
f9e3d4bc59 Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. 2011-06-04 23:25:36 +01:00
Andrew White
f1fe3c2d52 Raise NameError instead of ArgumentError in ActiveSupport::Dependencies
ActiveSupport::Dependencies now raises NameError if it finds an existing
constant in load_missing_constant. This better reflects the nature of
the error which is usually caused by calling constantize on a nested constant.

Closes #1423
2011-06-01 01:12:41 +01:00
Guillermo Iguaran
6a3b3fba5a Allow pluralize_table_names for individual model 2011-05-20 01:44:13 -05:00
Prem Sichanugrist
5ca67eca21 Add ActiveRecord::attribute_names to retrieve a list of attribute names. This method will also return an empty array on an abstract class or a model that the table doesn't exists. 2011-05-15 19:07:40 -04:00
knapo
bb498a5749 Fix assigning protected attributes by attributes= 2011-05-11 17:17:42 +02:00
Vishnu Atrai
33f0b6b67d minor cleaning 2011-05-10 22:51:54 +05:30
Aditya Sanghi
7d0f26796d Multiparameter POLA, time_select fixes. See LH4346 2011-05-05 15:41:14 +05:30
Josh Kalderimis
f9d5a7bb8c deprecated the use of the guard_protected_attributes argument with attributes= in AR in favor of assign_attributes(attrs, :without_protection => true) 2011-04-25 23:57:09 +02:00
Josh Kalderimis
a08d04bedf Added assign_attributes to Active Record which accepts a mass-assignment security scope using the :as option, while also allowing mass-assignment security to be bypassed using :with_protected 2011-04-24 09:53:18 +02:00
Jason Weathered
0fd0d68962 Bypass IdentityMap in PostgreSQL geometric tests.
The identity map cache prevents us from seeing the DB formatted strings.
2011-04-17 23:51:20 +10:00
Jon Leighton
8572ae6671 Evaluate default scopes at the last possible moment in order to avoid problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped. 2011-04-12 19:46:04 -07:00
Jon Leighton
5740d4ec0c Deprecated support for passing hashes and relations to default_scope, in favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details. 2011-04-12 19:46:04 -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
Sebastian Martinez
245542ea29 Added new #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 21:47:38 -03:00
Sebastian Martinez
0e1fed537a Revert "Removed #update_attribute method. New #update_column method."
This reverts commit 45c233ef81.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 18:55:30 -03:00
Sebastian Martinez
45c233ef81 Removed #update_attribute method. New #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-26 12:09:04 -03:00
Santiago Pastorino
baa237c974 Allow to read and write AR attributes with non valid identifiers 2011-03-22 20:02:32 -03:00
R.T. Lechow
a1b4d8e7b2 Active Record typos. 2011-03-05 11:56:34 +01:00
Aaron Patterson
f3e9cbc695 use an attribute rather than a SQL literal 2011-02-26 16:05:15 -08:00
Jon Leighton
a7e19b30ca Add interpolation of association conditions back in, in the form of proc { ... } rather than instance_eval-ing strings 2011-02-14 01:40:31 +00:00
Aaron Patterson
5548e47adb rawr, mysql, mysql2, why do you hate me. :'( 2011-02-09 13:35:56 -08:00
Aaron Patterson
d3b2596884 use parenthesis so limit works on all dbs 2011-02-09 11:51:09 -08:00
Ken Collins
56fb3b1594 Allow limit values to accept an ARel SQL literal. 2011-02-09 08:33:40 -08:00
Aaron Patterson
5046120b97 comma limits do not make sense on oracle or pg 2011-02-08 16:54:07 -08:00
Aaron Patterson
1c6f4562d7 primary keys should not be cleared on cache clear, fixing oracle tests 2011-02-08 16:01:16 -08:00
Aaron Patterson
0b58a7ff42 limit() should sanitize limit values
This fixes CVE-2011-0448
2011-02-08 14:21:12 -08:00
Jan
9643243204 make set_table_name take effect immediately 2011-02-08 10:31:09 -08:00
Aaron Patterson
7423a71fc0 allow AR caches to be cleared, clear them on class reloading 2011-02-03 15:35:44 -08:00
Guillermo Álvarez
351331fb34 Make serialized columns with explicit object_type return a new instance of the object instead of nil 2011-02-03 09:08:45 -08:00
Aaron Patterson
a0fac71922 store the serialized column values in the @attributes hash 2011-02-01 14:25:47 -08:00
Aaron Patterson
ebe485fd8e serialize can take an arbitrary code object 2011-02-01 14:25:47 -08:00
Jon Leighton
441118458d Use encode_with for marshalling 2011-01-07 15:03:15 -08:00
Pratik Naik
fd1cf13f74 Make serialized fixtures work again 2010-12-29 16:15:45 +00:00