Neeraj Singh
91fec0d24d
order should always be concatenated.
...
order that is declared first has highest priority in all cases.
Here are some examples.
Car.order('name desc').find(:first, :order => 'id').name
Car.named_scope_with_order.named_scope_with_another_order
Car.order('id DESC').scoping do
Car.find(:first, :order => 'id asc')
end
No special treatment to with_scope or scoping.
Also note that if default_scope declares an order then the order
declared in default_scope has the highest priority unless
with_exclusive_scope is used.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:13:42 -03:00
Santiago Pastorino
b451de0d6d
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 04:12:33 -03:00
Robert Pankowecki
f8b53f35b9
test and fix collection_singular_ids= with string primary keys [ #5125 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-02 16:41:20 +02:00
Neeraj Singh
992711a86b
update_attribute should not update readonly attributes
...
[#5106 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-21 14:55:57 +02:00
Will St. Clair + Neeraj Singh
b520d602ff
string IDs are now quoted correctly [ #5064 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-13 08:14:52 +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
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
Andrew White
8ec085bf18
Support fixtures for namespaced models [ #2965 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-25 16:04:38 +02:00
Aaron Patterson
cd6578f6a1
fixing invalid yaml [ #4424 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com>
2010-04-17 00:14:23 -04:00
Andrew White
9cea9bc7f0
Refactor compute_type to handle situations where the correct class is already loaded
...
Signed-off-by: wycats <wycats@gmail.com>
2010-04-12 21:31:20 -07:00
George Ogata
81ca0cf2b0
Add inverse polymorphic association support. [ #3520 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 15:12:13 +01:00
Jeremy Kemper
78790e47b8
Revert "Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.""
...
This reverts commit 2b82708b0efb3a3458e8177beab58f0c585788ae.
[#3128 state:resolved]
Conflicts:
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
2009-11-23 10:42:32 -08:00
Graeme Porteous
c01be9de32
Fix has_one with foreign_key and primary_key association bug which caused the associated object being lost when saving the owner. [ #1756 state:resolved]
...
Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 16:03:32 +02:00
Jeremy Kemper
3b6a9a020e
Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted."
...
Test failures on PostgreSQL.
[#3128 state:open]
This reverts commit da636809daca9c338200811d3590e446f57c8e81.
2009-09-02 13:55:47 -07:00
José Valim
da636809da
Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.
...
[#3128 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-01 10:15:23 -07:00
Gabe da Silveira
7e3364ac46
Fix that counter_cache breaks with has_many :dependent => :nullify.
...
[#1196 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:18:16 -07:00
Pratik Naik
45e6f19925
Revert "Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [ #2118 state:resolved]""
...
This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832.
The feature doesn't work on Postgres, so don't test it on Postgres.
Also, Postgres compatibility is irrelevant to the ticket/patch in question.
2009-07-01 00:02:00 +01:00
Yehuda Katz + Carl Lerche
80f1f863cd
Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [ #2118 state:resolved]"
...
This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a.
The tests do not pass for postgresql.
2009-06-22 12:04:02 -07:00
Patrick Joyce
4851ca9e13
Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [ #2118 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 22:07:23 +01:00
Benjamin Floering
27de7f150b
Fixed limited eager loading associations with numbers in the name [ #2668 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-18 13:56:17 +02:00
Jeremy Kemper
ddbeb15a5e
Revert "Fixed bug with polymorphic has_one :as pointing to an STI record"
...
[#2594 state:open]
This reverts commit 99c103be1165da9c8299bc0977188ecf167e06a5.
2009-05-11 12:20:54 -07:00
Murray Steele
ccea98389a
Providing support for :inverse_of as an option to associations.
...
You can now add an :inverse_of option to has_one, has_many and belongs_to associations. This is best described with an example:
class Man < ActiveRecord::Base
has_one :face, :inverse_of => :man
end
class Face < ActiveRecord::Base
belongs_to :man, :inverse_of => :face
end
m = Man.first
f = m.face
Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance.
Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic.
Signed-off-by: Murray Steele <muz@h-lame.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-04 15:27:39 -07:00
Ruy Asan
99c103be11
Fixed bug with polymorphic has_one :as pointing to an STI record
...
[#2594 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-01 14:47:56 -07:00
Jim Remsik and Tim Pope
1e6c50e21b
Ensure has_many :through works with changed primary keys [ #736 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 13:43:28 +00:00
Frederick Cheung
5cebe69e74
Preload uses exclusive scope [ #643 state:resolved]
...
With self referential associations, the scope for the the top level should not affect fetching of associations, for example
when doing
Person.male.find :all, :include => :friends
we should load all of the friends for each male, not just the male friends.
2008-12-26 18:25:55 +00:00
Matt Jones
a9422cc1db
Fix preloading of has_one :through associations on belongs_to [ #1507 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2008-12-18 19:19:36 +00:00
Matt Jones
d3fd997109
fix assignment to has_one :through associations.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-15 18:20:39 +01:00
Rob Anderton
2cee51d5c1
Added :constructor and :converter options to composed_of and deprecated the conversion block
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-10 18:28:47 +02:00
Andre Arko
3351d29970
Add has_many :primary_key option to allow setting the primary key on a has many association
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-06 20:25:10 +02:00
David Heinemeier Hansson
ab4d455d6d
Added missing files
2008-05-01 15:03:16 -05:00
Frederick Cheung
44d2142352
Ensure table names are quoted by the association preloading code.
...
[#45 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-04-26 12:14:50 +12:00
Rick Olson
081ddb6f24
Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 02:50:02 +00:00
Jeremy Kemper
5c1be2812d
has_one :through supports :source_type. Fix up some tests. References #4756 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-22 02:20:37 +00:00
Rick Olson
273b21faa9
Add has_one :through support, finally. Closes #4756 [thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:09:03 +00:00
Jeremy Kemper
5dee6ce9e0
Fix that batched :include would pull in duplicate records in some cases. Closes #11215 [Catfish]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-28 20:42:01 +00:00
Jeremy Kemper
558c5ff251
Fix preloading nil polymorphic belongs_to. Closes #11218 [matrix9180]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8933 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-27 22:41:35 +00:00
Michael Koziarski
f2546164d6
Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998 . [cpytel]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 00:14:54 +00:00
Jeremy Kemper
b1ea27630d
Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 03:27:31 +00:00
Jeremy Kemper
be827f9348
Fixed preloading belongs_to associations which reference a custom foreign key. References #9640 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-31 07:50:15 +00:00
Michael Koziarski
c48f744400
Make sure that belongs_to counter decrements when assigning nil Closes #10804 [jeanmartin]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-26 06:23:03 +00:00
Jeremy Kemper
32b36b8936
Add missing author_addresses.yml fixture. Closes #10592 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:21:12 +00:00
Jeremy Kemper
39814fcce0
Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00
Jeremy Kemper
16b129a68c
belongs_to supports :dependent => :destroy and :delete. Closes #10592 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8675 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 05:30:42 +00:00
Jeremy Kemper
105a27f39e
move schema
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8659 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:29:00 +00:00
Jeremy Kemper
e899a83a85
move migrations
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8658 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:28:07 +00:00
Jeremy Kemper
43b81d01d0
move assets and models
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:27:03 +00:00
Jeremy Kemper
8f7fa55e8d
Fixtures: removed support for the ancient pre-YAML file format. Closes #10736 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8594 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-08 03:54:40 +00:00
Jeremy Kemper
ebe3a0d532
More thoroughly quote table names. Exposes some issues with sqlite2 adapter. Closes #10698 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8571 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 14:58:28 +00:00
Jeremy Kemper
f6379bfe15
Eager belongs_to :include infers the foreign key from the association name rather than the class name. Closes #10517 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8456 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-21 01:49:01 +00:00
Rick Olson
66e97c34c1
Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-11 20:08:30 +00:00
David Heinemeier Hansson
6fd1a4d502
Fixed that habtm associations should be able to set :select as part of their definition and have that honored [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8309 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-05 21:37:51 +00:00
Jeremy Kemper
c7e3969189
Foxy fixtures: support single-table inheritance. Closes #10234 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8219 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-26 22:46:11 +00:00
Jeremy Kemper
8b3f83105c
Foxy fixtures: allow mixed usage to make migration easier and more attractive. Closes #10004 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8218 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-26 22:45:43 +00:00
David Heinemeier Hansson
f4b5ca1ff0
Fixed that create table with :id => false and fixtures don't play nice together ( closes #10154 ) [jbarnette]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8205 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-25 22:08:38 +00:00
Jeremy Kemper
9afbf875eb
Add example.log for binary escaping test. References #10176 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-22 01:30:22 +00:00
Jeremy Kemper
440f2890af
Dynamic finders on association collections respect association :limit. Closes #10227 [Jack Danger Canty]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-21 07:32:44 +00:00
Michael Koziarski
7d459203ee
Make Dynamic Finders on Association Collections Respect Association :order [patrick.t.joyce, technoweenie]. Closes #10211
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8174 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-21 01:51:57 +00:00
Michael Koziarski
c95f066bf5
Add 'foxy' support for fixtures of polymorphic associations. Closes #10183 [jbarnette, David Lowenfels]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8170 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-20 21:53:22 +00:00
Rick Olson
3104291322
Fix HasManyThrough Association so it uses :conditions on the HasMany Association. Closes #9729 [danger]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8128 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-11 01:03:43 +00:00
Jeremy Kemper
4b639904d7
Fix has_many :through delete with custom foreign keys. Closes #6466 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-27 18:51:32 +00:00
Jeremy Kemper
49eafd8c36
Foxy fixtures. Adapter#disable_referential_integrity. Closes #9981 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8036 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-26 05:56:46 +00:00
Marcel Molina
bf658a906b
Allow find on a has_many association defined with :finder_sql to accept id arguments as strings like regular find does. Closes #9916 [krishna]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8030 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-26 03:42:28 +00:00
Jeremy Kemper
7b42a1d0ac
Assigning an instance of a foreign class to a composed_of aggregate calls an optional conversion block. Refactor and simplify composed_of implementation. Closes #6322 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-23 17:39:35 +00:00
Jeremy Kemper
28729a4829
validates_uniqueness_of behaves well with abstract superclasses. References #3833 , closes #9886 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8000 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-23 06:18:42 +00:00
Michael Koziarski
210f7e29e2
Move all Schema creation into schema.rb for Mysql. Closes #9899 [mikong, lawrence]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7972 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-19 01:52:50 +00:00
Michael Koziarski
8ed1e885b7
Use a smaller binary fixture so we don't overflow column size limitations in some commercial / legacy databases. Closes #7987 [roderickvd, lawrence]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7958 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-17 21:35:46 +00:00
Jeremy Kemper
a72c1ec43e
Refactor association create and build so before & after callbacks behave consistently. Closes #8854 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7935 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-16 05:07:58 +00:00
Jeremy Kemper
9b6207c3d0
Quote table names. Defaults to column quoting. Closes #4593 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7932 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-16 05:06:33 +00:00
Jeremy Kemper
197c888576
Moving SQL Server tests to the extracted adapter. References #9884 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7930 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-16 05:05:22 +00:00
Tobias Lütke
0ad5365bf4
find_and_(initialize|create)_by methods can now properly initialize protected attributes
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7826 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-10 19:11:50 +00:00
Michael Koziarski
1c881ca5bf
Ensure that 'autosaving' works when associations aren't loaded [Bryan Helmkamp] References #8713
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7824 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-10 06:45:13 +00:00
Michael Koziarski
3122d321fd
Make sure AR::Base#clone handles attr changes made in after_initialize hooks. Closes #7191 [weyus]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7802 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-08 06:21:38 +00:00
Jeremy Kemper
4eaa8ba5be
PostgreSQL: support multiline default values. Closes #7533 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7801 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-08 06:17:53 +00:00
Michael Koziarski
8ef4bc6c75
Missed the add
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7754 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-06 01:03:19 +00:00
Michael Koziarski
638505b90f
Send the correct INSERT statement when dealing with objects with only primary keys. Closes #9523 [tarmo]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7753 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-06 00:49:58 +00:00
Rick Olson
24c2457a26
Don't call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module. [Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7748 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-05 19:27:33 +00:00
David Heinemeier Hansson
e86d1cd621
Added ActiveRecord::Base#to_json/from_json (currently does not support :include like to_xml) [DHH]. Added ActiveRecord::Base#from_xml [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7519 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-20 23:22:30 +00:00
Jeremy Kemper
81d619ea0d
Associations macros accept extension blocks alongside modules. Closes #9346 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-17 21:19:44 +00:00
Michael Koziarski
acbec3e565
Ensure that custom mutators aren't redefined by define_attribute_methods. [Koz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7500 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-17 09:29:02 +00:00
Jeremy Kemper
f7c371dff8
OpenBase: update for new lib and latest Rails. Support migrations. Closes #8748 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7472 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-13 23:21:14 +00:00
David Heinemeier Hansson
ea0975a20b
Moved acts_as_tree into a plugin of the same name on the official Rails svn ( closes #9514 ) [lifofifo]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7454 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-11 03:25:59 +00:00
David Heinemeier Hansson
11f4d28344
Moved acts_as_nested_set into a plugin of the same name on the official Rails svn ( closed #9516 ) [josh]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7453 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-11 03:09:37 +00:00
Michael Koziarski
aa36ca1c5f
Remove acts_as_list. Users are advised to install the new plugin. References #9415 . [josh, nzkoz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7444 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-10 04:41:09 +00:00
Michael Koziarski
29b0707f07
Improve performance and functionality of the postgresql adapter. Closes #8049 [roderickvd]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7329 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-08-16 06:26:30 +00:00
Michael Koziarski
82b244e3ff
Make sure has_many associations honour :include when counting. Closes #9167 [danger]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-08-16 04:36:55 +00:00
Michael Koziarski
d4bf5e9b34
Make habtm respect the :select option. Closes #9207 . [Aleksey Kondratenko]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7279 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-08-07 09:53:33 +00:00
Michael Koziarski
d0ff4ec193
Don't call unsupported methods on associated objects when using :include, :method with to_xml [manfred, jwilger] Closes #7307
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7156 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-06-30 03:31:48 +00:00
Jeremy Kemper
89c79b8b95
Fix polymorphic has_one associations declared in an abstract class. Closes #8638 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7119 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-06-25 22:42:19 +00:00
Jeremy Kemper
b2681cca2e
acts_as_nested_set: direct_children is sorted correctly. Closes #4761 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6903 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-30 06:34:25 +00:00
Rick Olson
c57c7210cd
Ensure that associations with :dependent => :delete_all respect :conditions option. Closes #8034 [danger, joshpeek, Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6827 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-24 20:39:51 +00:00
Rick Olson
f6edfa3553
forgot binary fixture
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6801 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-21 19:50:44 +00:00
Rick Olson
e3dab67c44
Allow a polymorphic :source for has_many :through associations. Closes #7143 [protocool]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6408 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-13 05:23:18 +00:00
Jeremy Kemper
98165fd31e
Consistently quote primary key column names. Closes #7763 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6364 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-09 03:23:37 +00:00
Jeremy Kemper
49d1f6a813
Fixtures: fix YAML ordered map support. Closes #2665 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6360 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-09 02:06:50 +00:00
Jeremy Kemper
0e8c3b8dd9
Fix has_many :through << with custom foreign keys. Closes #6466 , #7153 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6336 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-05 11:34:39 +00:00
Jeremy Kemper
b2c0359b3e
SQLServer: recognize real column type as Ruby float, correctly schema-dump tables with no indexes or descending indexes. References #7057 , #7703 . Closes #7333 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6297 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-03 14:20:57 +00:00
David Heinemeier Hansson
87b7b5b3e7
Added fixtures :all to test_helper.rb to assume that most people just want all their fixtures loaded all the time [DHH] Added fixtures :all as a way of loading all fixtures in the fixture directory at once ( closes #7214 ) [manfred]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6227 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-02-25 17:31:43 +00:00
Jeremy Kemper
269ad9711d
MySQL: blob and text columns may not have defaults in 5.x. Update fixtures schema for strict mode. Closes #6695 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6074 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-28 15:45:06 +00:00
Jeremy Kemper
06afb8c746
Subclasses of an abstract class work with single-table inheritance. References #5704 , closes #7284 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6013 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-23 04:19:16 +00:00
Jeremy Kemper
e310344111
Oracle: create_table takes a :sequence_name option to override the 'tablename_seq' default. Closes #7000 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5933 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-15 00:34:43 +00:00
Jeremy Kemper
9073cef866
SQLServer: handle [quoted] table names. Closes #6635 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5891 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-12 05:44:28 +00:00
Jeremy Kemper
8d3ff3abc7
acts_as_nested_set works with single-table inheritance. Closes #6030 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5889 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-12 05:33:09 +00:00
Jeremy Kemper
353238b6a4
Inline primary keys.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5885 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-12 04:58:08 +00:00
Michael Koziarski
84481dd3b4
Sybase adapter fixes. Closes #6926 [jsheets]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5839 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-05 00:12:06 +00:00
Jeremy Kemper
5f18fd93de
utf8 mysql topics table
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5749 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-19 18:04:42 +00:00
Jeremy Kemper
8ffb22056c
Subclasses of an abstract class work with single-table inheritance. Closes #5704 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-01 21:24:47 +00:00
Jeremy Kemper
19c99acfbc
MySQL: detect when a NOT NULL column without a default value is misreported as default ''. Can't detect for string, text, and binary columns since '' is a legitimate default. Closes #6156 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5586 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 08:54:42 +00:00
Jeremy Kemper
50ee332c4a
Cleanup SQLite AUTOINCREMENT: exclude sqlite_sequence table, factor out feature availability check.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5520 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-14 03:32:16 +00:00
Jeremy Kemper
70840d4b7f
Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults. Factor out some common methods from all adapters. Closes #6515 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-01 20:28:48 +00:00
Rick Olson
cdb5132c41
Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783 . [Jonathan Viney]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5305 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-15 16:37:11 +00:00
Rick Olson
8e3bf70bcd
Removes the ability for eager loaded conditions to be interpolated, since there is no model instance to use as a context for interpolation. #5553 [turnip@turnipspatch.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5264 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 02:46:57 +00:00
David Heinemeier Hansson
9fd88d7939
Deprecated add_on_boundary_breaking (use validates_length_of instead) ( closes #6292 ) [BobSilva]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5255 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 01:42:09 +00:00
Jeremy Kemper
3f1acf49bd
Deprecation tests. Remove warnings for dynamic finders and for the foo_count ethod if it's also an attribute.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5116 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-15 07:02:05 +00:00
Jeremy Kemper
528618a910
Optimistic locking: gracefully handle nil versions, treat as zero. Closes #5908 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4958 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-04 00:02:38 +00:00
Jeremy Kemper
d0696d7641
to_xml: the :methods option works on arrays of records. Closes #5845 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4909 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-02 21:00:09 +00:00
Jeremy Kemper
667d8ea2ea
Commit stray fixture.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4897 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-02 02:51:01 +00:00
Jeremy Kemper
b1257d96b7
has_many :through conditions are sanitized by the associating class. Closes #5971 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-01 05:31:56 +00:00
Jeremy Kemper
3704088ebd
has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. Closes #5927 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-29 17:06:27 +00:00
Jeremy Kemper
842ce34bbc
Fixtures: correct escaping of \n and \r. Closes #5859 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4811 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-24 01:50:24 +00:00
Jeremy Kemper
8cbe22ab51
Migrations: gracefully handle missing migration files. Closes #5857 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4809 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-23 05:49:40 +00:00
Jeremy Kemper
32dcfa6913
MySQL: update test schema for MySQL 5 strict mode. Closes #5861 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4808 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-23 05:30:14 +00:00
Jeremy Kemper
50be89b609
Shorten index name.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4777 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-16 18:22:51 +00:00
Jeremy Kemper
7aaf4867d2
Included associations: go deep.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-16 18:10:52 +00:00
Jeremy Kemper
d7f780e066
Fix for deep includes on the same association.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-14 07:19:47 +00:00
Jeremy Kemper
2a12b56841
r4704@asus: jeremy | 2006-06-27 12:00:19 -0700
...
decimal
r4705@asus: jeremy | 2006-06-27 12:20:47 -0700
current_adapter? checks whether any of its arguments is the name of the current adapter class
r4834@asus: jeremy | 2006-07-08 13:08:24 -0700
Room to float.
r4835@asus: jeremy | 2006-07-08 13:09:18 -0700
Give lock test a few chances.
r4836@asus: jeremy | 2006-07-08 13:12:05 -0700
Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. Closes #5454 .
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4596 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-07-08 20:35:56 +00:00
Jeremy Kemper
a3f459eecf
Firebird migrations support. Closes #5337 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4594 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-07-08 17:13:21 +00:00
Jeremy Kemper
c4233a0eae
PostgreSQL: correctly quote microseconds in timestamps. Closes #5641 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4579 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-07-07 17:40:22 +00:00
Jeremy Kemper
42775686d2
PostgreSQL: support microsecond time resolution. Closes #5492 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-25 18:04:06 +00:00
David Heinemeier Hansson
9c0fb70e1e
For Firebird adapter
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4423 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-03 21:52:22 +00:00
David Heinemeier Hansson
6a9f47f33f
Make more Firebird tests pass ( closes #5188 ) [kennethkunz@gmail.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-03 21:47:29 +00:00
Jeremy Kemper
48052d70ec
to_xml fixes, features, and speedup. Closes #4989 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4413 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-03 00:01:08 +00:00
Rick Olson
ea51d72edb
Provide Association Extensions access to the instance that the association is being accessed from. Closes #4433 [josh@hasmanythrough.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4372 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-28 21:33:34 +00:00
David Heinemeier Hansson
59c8c63ecd
Added :allow_nil option for aggregations ( closes #5091 ) [ian.w.white@gmail.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4353 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-21 17:32:37 +00:00
Marcel Molina
d22f9c9488
Fix Oracle boolean support and tests. Closes #5139 . [schoenm@earthlink.net]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4351 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-21 15:13:28 +00:00
Jeremy Kemper
d59f3a78a4
uniq preserves order. References [4325].
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4326 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-07 02:03:25 +00:00
Jeremy Kemper
50f538b72b
Allow :uniq => true with has_many :through associations.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-06 23:37:56 +00:00
Marcel Molina
3fec943aca
Allow AR::Base#to_xml to include methods too. Closes #4921 . [johan@textdrive.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4314 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-29 23:00:47 +00:00
Marcel Molina
f42403ff49
Remove duplicate fixture entry in comments.yml. Closes #4923 . [Blair Zajac <blair@orcaware.com>]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4305 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-29 05:02:54 +00:00
Marcel Molina
b2c0ddf033
Add support for FrontBase ( http://www.frontbase.com/ ) with a new adapter thanks to the hard work of one Mike Laster. Closes #4093 . [mlaster@metavillage.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4291 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-27 22:39:45 +00:00
Marcel Molina
9a5b91a329
Sybase Adapter type conversion cleanup [dev@metacasa.net]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4270 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-25 19:11:24 +00:00
Rick Olson
df7b74668e
Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility. [Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-19 21:37:54 +00:00
Rick Olson
7e76740d2a
Allow multiple association extensions with :extend option ( closes #4666 ) [Josh Susser]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-11 01:10:42 +00:00
David Heinemeier Hansson
8eb73f43e1
Fixed that that multiparameter assignment doesn't work with aggregations ( closes #4620 ) [Lars Pind]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-06 16:16:29 +00:00
Rick Olson
a9fb1544b0
Added support for eagerly including polymorphic has_one associations. ( closes #4525 ) [Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4170 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-05 17:01:56 +00:00
Rick Olson
4d232025b7
Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many [Rick]
...
Added support for going through a polymorphic has_many association: (closes #4401 ) [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4169 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-05 15:36:02 +00:00
Rick Olson
38bae0a969
Change has_many :through to use the :source option to specify the source association. :class_name is now ignored. [Rick Olson]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-24 14:46:17 +00:00
Rick Olson
6fbf408238
Allow overriding of find parameters in scoped has_many :through calls [Rick Olson]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4007 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-21 16:33:22 +00:00
Rick Olson
c8470f8a5b
add self referential has_many :through example [Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4006 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-21 01:07:16 +00:00
David Heinemeier Hansson
1aff68d615
Fix bug introduced by changeset 3679 which caused custom attribute? methods to be overridden. Also ensure that ? methods are defined even if read method is customised. ( closes #3677 ) [jonathan@bluewire.net.nz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4002 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-20 06:45:34 +00:00
Rick Olson
9a72cd22cf
Don't classify the has_one class when eager loading, it is already singular. Add tests. ( closes #4117 ) [jonathan@bluewire.net.nz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3983 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-19 19:32:07 +00:00