J. Pablo Fernández
21957b72ea
Test that adding an index also doesn't raise an exception.
...
[#4809 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 21:17:12 +02:00
Paul Barry
0baf83fa18
Replaced statement in comment with an assertion
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 21:17:08 +02:00
J. Pablo Fernández
ff22b9d451
Fixed error when removing an index from a table name values, which is a reserved word, with test.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 21:17:07 +02:00
José Valim
67582f08bf
Push a failing test for issues [ #4994 ] and [ #5003 ].
2010-06-29 19:50:09 +02:00
David Trasbo
735a4db685
Remove ActiveRecord::Base#class_name [ #379 state:committed]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 17:54:51 +02:00
José Valim
bd1666ad1d
Add scoping and unscoped as the syntax to replace the old with_scope and with_exclusive_scope. A few examples:
...
* with_scope now should be scoping:
Before:
Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
After:
Comment.where(:post_id => 1).scoping do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
* with_exclusive_scope now should be unscoped:
class Post < ActiveRecord::Base
default_scope :published => true
end
Post.all #=> SELECT * FROM posts WHERE published = true
Before:
Post.with_exclusive_scope do
Post.all #=> SELECT * FROM posts
end
After:
Post.unscoped do
Post.all #=> SELECT * FROM posts
end
Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values:
Post.unscoped.all #=> SELECT * FROM posts
2010-06-29 17:18:55 +02:00
Neeraj Singh
40e87ac669
with_exclusive_scope does not work properly if ARel is passed. It does work nicely if hash is passed. Blow up if user is attempting it pass ARel to with_exclusive_scope.
...
[#3838 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 01:18:20 +02:00
Santiago Pastorino
6c28959e86
Move sqlite to sqlite3 for this tests to be run only on sqlite3 adapter
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-28 01:26:25 +02:00
George Montana Harkin
0c0b0aa0f2
Fixes #2415 by creating a new instance of the Model when saving attributes to that model and the associated attributes already exist. Tests included. [ #2415 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-27 16:35:03 +02:00
Aaron Patterson
100d2282e3
adding adapter tests, avoiding private apis, fixing code in 1.9 [ #4986 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 22:37:45 +02:00
Santiago Pastorino
47134a04bb
blocks removed from all the ActiveRelation query_methods, extend method added instead
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 01:35:23 +02:00
José Valim
026cec3390
Merge branch 'tago'
2010-06-26 01:08:57 +02:00
Andrew White
11ff3da5f4
Add column and index query methods to ActiveRecord::Schema
...
[#4219 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 01:08:32 +02:00
Aaron Patterson
4464d10e68
index dump should not include full text indexes. Thanks Ken Mayer for the original patch! [ #4949 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 00:59:38 +02:00
Santiago Pastorino
65aa6a7db1
reorder method added to ActiveRelation
...
[#4972 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 00:59:12 +02:00
Santiago Pastorino
a2513aea07
Test for concatenated orders added
...
[#4972 ]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 00:59:11 +02:00
Aaron Patterson
5e2b473b47
reorganizing adapter specific tests. [ #4974 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-06-25 14:47:14 -07:00
Santiago Pastorino
efbd0eb9f7
Order is not guaranteed here, ordering by id of people table makes it work
2010-06-25 12:44:57 -07:00
Neeraj Singh and Santiago Pastorino
0ebb5bf659
Support for multiple selects added
...
[#4841 state:committed]
2010-06-25 15:57:04 -03:00
Emilio Tagua
fdb7f84eb1
Remove deprecated block usage in composed_of.
2010-06-24 11:17:05 -03:00
José Valim
6788db824a
Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing frameworks like ActiveRecord and ActiveResource to log outsude Rails::Application [ #4816 state:resolved]
2010-06-24 13:23:43 +02:00
Emilio Tagua
5441e082f9
Add tests for relation count. Fix other tests that were conceptually wrong.
...
[#4882 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-24 11:41:55 +02:00
Neeraj Singh
0bf3baa6b3
adding fix for to_xml for ActiveRecord relation object
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 18:00:32 +02:00
Neeraj Singh
eb04408a20
ActiveRecord's relation object should respond to to_json and to_yaml
...
[#4547 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 18:00:25 +02:00
Neeraj Singh
a3ce6fcc56
adding column named 'group' to ensure that nothing breaks given that 'group' is sql reserved word
...
[#4945 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 17:46:37 +02:00
Paul Gillard
d132dd3352
Don't clone associations [ #4894 state:resolved]
...
Cloning an active record object should be shallow in that it should copy attributes but not associations. This was no longer true as a result of #3164 .
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 09:27:15 +02:00
Jeff Dean
e639536ea8
remove_column should raise an ArgumentError when no columns are passed [ #4803 state:resolved]
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2010-06-23 16:21:29 +12:00
Santiago Pastorino
f61ac89947
Avoid method redefined warning
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-22 21:16:59 +02:00
Neeraj Singh
7033be5f72
test for #4917
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-22 18:04:38 +02:00
Emilio Tagua
7df105b1e6
Fix order method to accept relation attributes.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-22 16:44:10 +02:00
Jeroen van Dijk
26392c4ac5
Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options.
...
This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format".
Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation.
Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options).
Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now.
The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet.
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-21 11:55:21 +02:00
rohit
95a8f252c0
remove executable permission from files that don't need it. [ #4802 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-20 00:50:48 +02:00
James Le Cuirot
f664c57fe8
Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. Reapplied from before but now allows already-saved records to be refreshed.
...
[#4830 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-20 00:32:06 +02:00
José Valim
72725d7b7f
Merge branch 'master' of github.com:rails/rails
2010-06-20 00:12:54 +02:00
José Valim
033e0a041f
ActiveRecord and ActionPack now use the new descendants implementation.
2010-06-19 17:15:21 +02:00
Master Lambaster
a7cae64104
Fix test which prevents connection reset on failing and remove hardcoded connection
...
[#4689 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-06-18 15:28:14 -07:00
Brian Durand
237165feb3
Fix bug with rolling back frozen attributes.
...
[#2991 ]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-06-18 15:11:17 -07:00
Aaron Patterson
8e56085817
use assert_in_delta() for floating point comparisons in tests [ #4871 state:resolved]
...
Signed-off-by: Carl Lerche <carllerche@mac.com >
2010-06-16 10:09:59 -07:00
Xavier Noria
f17159b029
edit pass: the names of Rails components have a space, ie, "Active Record", not "ActiveRecord"
2010-06-14 23:22:04 +02:00
José Valim
85cc1fa657
Revert "Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [ #4642 state:open]"
...
This commit introduced a regression described in ticket [#4830 ].
This reverts commit 0265c708b9 .
2010-06-11 17:05:54 +02:00
Neeraj Singh
e11bb95d56
Validators should at model level and not at AR:Base level [ Closes #4804 ]
...
[#4804 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com >
2010-06-10 11:50:42 -04:00
James Le Cuirot
0265c708b9
Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [ #4642 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-06-09 18:17:52 +05:30
Santiago Pastorino
6898c167c3
Make sure about which is the first element of the query, fixes a postgresql 8.4 failing test
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-09 10:06:41 +02:00
Santiago Pastorino
cfacae1a7d
SQLite2Adapter doesn't exist
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-09 10:06:24 +02:00
Jeremy Kemper
b070739240
Revert "Temporarily revert "Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction.""
...
This reverts commit 1b2941cba1 .
[#2991 ]
2010-06-08 17:05:29 -04:00
Emilio Tagua
4b4a548a60
Avoid PostgreSQL and MySQL tests warnings.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-08 22:36:19 +02:00
Andrew Bloomgarden
0e9b9d5985
Fix ActiveRecord::Base.compute_type swallowing NoMethodError. [ #4751 state:resolved]
...
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com >
2010-06-08 15:34:47 -04:00
Emilio Tagua
ab2877cbe8
Add parentheses to avoid warnings when running AR tests.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-08 21:16:19 +02:00
Jeremy Kemper
1b2941cba1
Temporarily revert "Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction."
...
This reverts commits d2a49e4b1f and da840d13da .
[#2991 ]
Conflicts:
activerecord/CHANGELOG
activerecord/lib/active_record/transactions.rb
activerecord/test/cases/transaction_callbacks_test.rb
2010-06-08 14:56:08 -04:00
Ernie Miller
a4eaa1fd39
Fix multiple self-referencing eager loads failing to join multiple times
...
[#4679 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-06-08 01:02:19 -04:00