David Trasbo
786342e17f
Return from ActiveRecord::Base#attributes= unless value is a hash [ #4070 state:committed]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 23:24:20 +02:00
Neeraj Singh
1e53404fe9
reset_counter should work with non-traditional belongs_to and polymorphic belongs_to
...
[#4984 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 23:24:12 +02:00
Neeraj Singh
01629d1804
This patch changes update_attribute implementatino so:
...
- it will only save the attribute it has been asked to save and not all dirty attributes
- it does not invoke callbacks
- it does change updated_at/on
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 22:43:18 +02:00
Grant Ammons
17650e394f
Eager loading :through associations will join the :source model if there are :conditions. [ #2362 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 22:36:26 +02:00
Ken Collins
0e9bc23c0e
Fix the #using_limitable_reflections? helper to work correctly by not examining the length of an array which contains false/true, hence always passing. [ #4869 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 22:34:34 +02:00
Thiago Pradi
8b2330ebc3
Tests to specify the behaviour of ActiveRecord::Migrator.get_all_versions() [ #5066 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 22:29:08 +02:00
Mislav Marohnić
00f1cd71a9
fix ActiveRecord destroy_all so it returns destroyed records
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-07-08 11:35:17 -07:00
Josh Kalderimis
4b66aab00f
mass_assignment_security moved from AR to AMo, and minor test cleanup
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 18:28:45 +02:00
Josh Kalderimis
7c86e8e21b
minor changes to mass assignment security patch to bring it in line with rails standards
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 18:28:38 +02:00
Eric Chapweske
606088df3f
Mass assignment security refactoring
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 18:28:32 +02:00
Neeraj Singh
723a0bbe3a
This test never runs and it has never run. Since the day this file
...
was created this test has name not beginning with test_. Also this
test is trying to use has_many on another has_many which is not
supported.
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 18:02:07 +02:00
Ben Somers
de51cbccf8
Fixed gruoped_by_title spelling [ #5063 state:committed]
...
Signed-off-by: Xavier Noria <fxn@hashref.com >
2010-07-08 00:26:25 +02:00
Aaron Patterson
c58e7a71b5
adding some behavioral tests for the sqlite adapter. [ #5065 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-07-07 14:25:22 -07:00
James Le Cuirot
f3fedd7f84
Don't remove scheduled destroys when loading an association. [ #4642 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-01 01:06:58 +02:00
Aaron Patterson
3f563f1696
AssociationCollection#create_by_*, find_or_create_by_* work properly now. [ #1108 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-06-29 16:13:40 -07:00
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