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
Pavel Forkert
96acdd3ec4
Added test case and fix for proper eager loading associations
2011-04-22 12:06:15 -05:00
Jon Leighton
019cd51a3f
Bring back support for passing a callable object to the default_scope macro. You can also just use a block.
2011-04-18 23:35:22 +01:00
Jon Leighton
6f84c73dc4
Un-deprecate using 'default_scope' as a macro, but if you are calling the macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
2011-04-18 23:15:38 +01:00
Jon Leighton
2a5e317951
Fix test_associate_existing in has_many_through_associations_test on mysql and postgresql
2011-04-17 21:58:47 +01:00
Jon Leighton
256b363eee
Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead."
...
This reverts commit f0e198bfa1 .
Conflicts:
activerecord/test/models/post.rb
2011-04-17 20:47:52 +01: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
65469a6e5e
Return nil from read_attribute(:foo) if 'foo' is not present in the @attributes hash, but the _foo method has been defined. This brings the behaviour into line with the 3-0-stable branch and the master branch before 93641ed6c8 (there were previously no assertions about this which is why the change slipped through). Note that actually calling the 'foo' method will still raise an error if the attribute is not present.
2011-04-15 13:27:08 +01:00
Jon Leighton
e01dfb27fc
Undo performances regressions I introduced in bbe0a507f2 and add test for an edge case. Add comments to explain the intent of the code.
2011-04-15 13:09:12 +01:00
Jon Leighton
e68a83c9ec
Refactor test to avoid hackery
2011-04-15 02:19:11 +01:00
Jon Leighton
bbe0a507f2
Remove unnecessary code from define_read_method and add assertion to make sure the underscored version is actually generated
2011-04-15 01:44:27 +01:00
Aaron Patterson
a22ceaeefa
mysql type cast should return integers when typecasting true / false
2011-04-14 13:37:39 -07:00
Aaron Patterson
a0d4c8d1bf
using the database adapter to typecast before executing prepared statement
2011-04-14 13:37:39 -07:00
Aaron Patterson
27f8c57f5f
inserting big decimals as strings works consistently among dbs, so use string form
2011-04-14 13:37:39 -07:00
Aaron Patterson
4893170da2
adding a type cast method for prepared statements
2011-04-14 13:37:38 -07:00
Aaron Patterson
1f4dae9daa
do not depend on to_yaml being called, but rather depend on YAML being dumped
2011-04-13 11:41:42 -07:00
Aaron Patterson
eebb19c954
use index based substitution for bind parameters
2011-04-13 09:42:51 -07:00
Prem Sichanugrist
733bfa63f5
Remove #among? from Active Support
...
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.
It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
Aaron Patterson
1b5b53da5e
common @jonleighton 💣
2011-04-12 20:29:35 -07:00
Jon Leighton
f0e198bfa1
Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead.
2011-04-12 19:46:05 -07:00
Jon Leighton
788bd30859
ActiveRecord::Base.scopes hash is not needed
2011-04-12 19:46:04 -07: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
Jon Leighton
fc9a04b6a6
Removing the scope-caching which happens on association proxies, because the query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
2011-04-12 19:46:04 -07:00
David Heinemeier Hansson
d1575ae1b9
Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion!
2011-04-12 00:23:07 +02:00
Aaron Patterson
622f23b604
wrap the pg_get_serial_sequence function and reuse it for the default sequence name
2011-04-11 14:38:42 -07:00
Aaron Patterson
58259bbf29
adding exec_insert for postgresql
2011-04-11 10:10:01 -07:00
Aaron Patterson
b1ba04b32b
fixing variable name in mysql test
2011-04-11 10:10:01 -07:00
Aaron Patterson
3d96e6217b
adding mysql adapter test case
2011-04-11 10:10:00 -07:00
Aaron Patterson
32dbf00d99
adding exec_insert to sqlite3
2011-04-11 10:10:00 -07:00
Prem Sichanugrist
a9f3c9da01
Using Object#in? and Object#either? in various places
...
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
Aaron Patterson
508c679f11
moving sqlite_adapter_tests to sqlite3_adapter_test so that the tests are actually run. 💣
2011-04-08 11:22:21 -07:00
Emilio Tagua
18dde7bf4f
Disable IdentityMap in log tests, it's not important and when running tests rake task it logs more messages in the tested buffer.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2011-04-05 22:08:00 +02:00
Durran Jordan
a9b4b5da7c
Destroying records via nested attributes works independent of reject_if:
...
- When a :_destroy truthiness is provided in the attributes hash, the
record should get destroyed regardless of the result of the proc or
method supplied to :reject_if. (If :allow_destroy is true)
[#6006 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-04-05 10:38:54 -03:00
Emilio Tagua
454ec93ff7
Add log message when loading records from Identity Map.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2011-04-04 10:48:17 +02: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
2be383b946
test against AR class rather than the relation (thanks Andrew White!)
2011-03-29 17:50:39 -07: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
Aaron Patterson
58becf1165
order is not guaranteed by this select, so add an order and call first!
2011-03-29 17:27:32 -07:00
Aaron Patterson
6067d29a1f
oracle stores this with microseconds, so convert to seconds before comparing
2011-03-29 17:09:22 -07:00
Aaron Patterson
c7b7c6ad1c
make sure that active connections are not cleared during test when an exception happens
2011-03-29 15:47:16 -07:00
Aaron Patterson
3b2a032677
clearing active connections in the ConnectionManagement middleware if an exception happens
2011-03-29 15:42:32 -07:00
Aaron Patterson
e5246092d1
proxy body responses so we close database connections after body is flushed
2011-03-29 15:37:07 -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
a9dafbb28d
Delegate first!, last!, any? and many? to scoped
2011-03-29 17:21:21 +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
Aaron Patterson
aea1477362
make sure we have an active database connection before running each connection management test
2011-03-28 17:47:46 -07:00
Aaron Patterson
25f94971ab
adding active_connections? to the connection pool for finding open connections
2011-03-28 17:29:37 -07:00
Aaron Patterson
4211866b7a
adding active_connection? to the connection pool
2011-03-28 16:43:34 -07:00
Aaron Patterson
ec0cacc293
testing app delegation from the ConnectionManagement middleware
2011-03-28 16:22:37 -07:00