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 2b82708b0e .
[#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
Justin Bailey
c9d3c48dc6
Enable use of MySQL stored procedures by default.
...
[#3204 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-09-17 10:57:03 -07: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 da636809da .
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
Leonardo Borges
0c391b46fb
PostgreSQL: XML datatype support
...
[#1874 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-09 22:24:54 -07:00
railsbob
e06a0b03c8
has_many :through create should not raise validation errors
...
[#2934 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-09 18:44:45 -07:00
Raimonds Simanovskis
9b2309c4a8
fix schema_dumper_test for Oracle as it supports precision up to 38
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
963570b51c
added additional objects necessary for OracleAdapter specific tests
...
if OracleAdapter is used then use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
Oracle SELECT WHERE clause which causes many unit test failures
2009-08-06 23:40:59 +03:00
Joshua Peek
aad5a30bf2
Add simple support for ActiveModel's StateMachine for ActiveRecord
2009-08-04 11:03:57 -05:00
Szymon Nowak
1c11437a32
Add primary_key option to belongs_to association
...
[#765 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-07-15 18:13:32 -07:00
mattbauer
83c1934003
Ensure hm:t#create respects source associations hash conditions [ #2090 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-06-21 17:35:04 +01:00
Raimonds Simanovskis
63091cef2e
disabled base_test.rb tests that were not Oracle compatible (TIME datatype is not supported on Oracle, UPDATE does not support ORDER BY) _before_type_cast on Oracle returns Time and not String added Oracle specific schema definition that was missing for test_default_values test
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2009-06-09 20:26:55 +12:00
Giles Alexander
532219fd09
Schema dumper now records scale 0 decimal columns as decimal not integer.
...
The schema dumper would dump out any decimal or numeric column that had a zero
scale as an integer column. This will cause problems for very large precision
columns on some DBMSs, particularly PostgreSQL. It also looks strange to see
your column change type after moving through schema.rb.
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#2741 state:committed]
2009-06-01 13:40:05 +12: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
Mislav Marohnić
b33c0d9832
replace the aaa_create_tables_test hack with loading test database schema in the test helper [ #2663 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-05-17 13:51:35 -05:00
Jeremy Kemper
ddbeb15a5e
Revert "Fixed bug with polymorphic has_one :as pointing to an STI record"
...
[#2594 state:open]
This reverts commit 99c103be11 .
2009-05-11 12:20:54 -07:00
Mike Breen
9010ed2755
Allow you to pass :all_blank to :reject_if option to automatically create a Proc that will reject any record with blank attributes.
2009-05-10 15:02:00 +12: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
Max Lapshin
f3ac4f387d
Fixed dumping from postgresql columns in index in wrong order. [ #2515 state:resolved]
...
Signed-off-by: Tarmo Tänav <tarmo@itech.ee >
2009-04-21 11:44:13 +01:00
Scott Woods
64b33b6cf9
Quote table names when casting to regclass so that capitalized tables are supported. [ #2418 state:resolved]
...
Signed-off-by: Tarmo Tänav <tarmo@itech.ee >
2009-04-21 11:43:38 +01:00
David Heinemeier Hansson
abb899c54e
Added :touch option to belongs_to associations that will touch the parent record when the current record is saved or destroyed [DHH]
2009-04-16 17:25:55 -05: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
Arthur Klepchukov
ccb0a92fa2
Ensure validates_uniqueness_of considers limit on the field. [ #1042 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-03-07 13:52:17 +00:00
Eloy Duran
ec8f045844
Add support for nested object forms to ActiveRecord and the helpers in ActionPack
...
Signed-Off-By: Michael Koziarski <michael@koziarski.com >
[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Jacob Dunphy
e6493eb9b7
Sqlite adapter's copy_table incorrectly attempts to recreate a primary key id (:id => true in the create_table) if an :id column is present, even if it isn't a primary_key.
...
This fix sets :id => false if there is an :id column, but it's not the primary_key.
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1766 state:committed]
2009-01-29 17:34:33 +13:00
Carlos Kozuszko
5ed119c005
Fix dirty handling of nullable non-integer numeric columns [ #1692 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2009-01-16 17:23:35 +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
Ken Collins
8e4624be9e
Remove SQL Server cases from tests for latest adapter work to pass rails expected behavior.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-11-19 18:00:56 +01: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
Tarmo Tänav
973c0ef26d
Create mysql binary_fields table with latin1 character set as with utf8 all the limits would have to be divided by 3 to get the expected text types
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-08-26 01:49:19 -07:00
Josh Susser
e48e77e022
coerce blank strings to nil values for boolean and integer fields
...
[#860 state:resolved]
2008-08-22 16:26:40 -07:00
miloops
459e5817a5
update_counters should update nil values.
...
This allows counter columns with default null instead of requiring default 0.
[#493 state:resolved]
2008-07-15 16:21:11 -07: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
Tarmo Tänav
baddea95e1
Always treat integer :limit as byte length. [ #420 state:resolved]
2008-06-22 20:42:31 -07:00
Alex MacCaw
4cc594bd70
Fix validates_uniqueness_of for SQL keywords [ #23 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-11 19:30:03 +01:00
David Heinemeier Hansson
6f20efdaf7
Fixed AssociationsPreload such that it doesnt require foreign keys to be integers (fcheung) [ #33 state:resolved]
2008-04-30 23:30:50 -05:00
David Heinemeier Hansson
c353794dff
Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [ #67 state:resolved]
2008-04-30 15:04:08 -05:00
Frederick Cheung
a6cca5d1fc
Ensure postgresql tests work when starting from scratch.
2008-04-30 21:54:54 +12: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
Frederick Cheung
a4fc93c3a9
Use schema.rb for all databases
...
Move adapter specific schema into their own files
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-04-22 13:55:13 +12:00
Rick Olson
8a5a9dcbf6
Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [jordi]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-09 16:20:15 +00:00
Jeremy Kemper
98d87f38fc
Fix schema.rb some more. sponsors.sponsorable_type should be a string. References #4756 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 23:15:21 +00:00
Jeremy Kemper
36baabe24c
Fix schema.rb. Please to be testing on more than just MySQL! References #9067 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9072 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 23:10:42 +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
Michael Koziarski
c1abe44306
Make the mysql schema dumper roundtrip the limits of text/blob columns. Closes #7424 [will.bryant]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8969 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-02 04:42:10 +00:00
Jeremy Kemper
9a947af0e7
PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. Closes #11127
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8922 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-22 03:26:21 +00:00