Commit Graph

126 Commits

Author SHA1 Message Date
Aslak Hellesøy
10fdf44236 Added protection against duplicate migration names (Aslak Hellesøy) [#112 state:resolved] 2008-05-11 13:37:29 -05: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
gbuesing
328fada610 ActiveRecord time zone aware attributes: blank string is treated as nil when assigned to writer 2008-05-08 20:31:54 -05:00
Scott Fleckenstein
eb5b93be74 Fix Time.zone.parse from stripping time zone information and make Time aware attribute methods use Time.zone.parse instead of to_time 2008-05-08 19:25:31 -05:00
Andreas Neuhaus
bcb090c56b Calling ActiveRecord#inspect on an unloaded association won't wipe the collection [#9 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-05-08 00:04:53 -05:00
Tarmo Tänav
0a21193dc6 create_table :force => true no longer tries to drop a non-existing table
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-07 13:01:46 +12:00
Tarmo Tänav
8877ab5852 Added AbstractAdapter#table_exists? and made AbstractAdapter#table implementation non-optional
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-07 13:01:46 +12:00
John Devine
8ded457b1b Added logic to associations.rb to make sure select_for_limited_ids
includes joins that are needed to reach tables listed in the :order
or :conditions options if they are not joined directly to the main
active_record table.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#109 state:resolved]
2008-05-06 21:47:10 +12:00
Frederick Cheung
fbebdb0c09 Ensure correct record is returned when preloading has_one where more than one row exists
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#73 state:closed]
2008-05-06 21:08:52 +12:00
David Heinemeier Hansson
96980bd561 Added change_table for migrations (Jeff Dean) [#71 state:resolved] 2008-05-03 11:29:47 -05:00
Jeremy Kemper
e931394d09 Fix failing associate_with_create tests inserting null first_name 2008-05-01 13:53:10 -07:00
David Heinemeier Hansson
e2af713d1c Merge branch 'master' of git@github.com:rails/rails 2008-05-01 14:32:50 -05:00
Steven Soroka
9c20391bbe best solution?
Signed-off-by: Steven Soroka <ssoroka78@gmail.com>
2008-05-01 14:22:55 -05: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
dd120ede53 Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) [#39 state:resolved] 2008-04-30 23:14:32 -05:00
Rhett Sutphin
b4c33711c5 Fixed fixture caching with prefixed or suffixed tables.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-04-30 16:59:22 -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
David Heinemeier Hansson
874603ce8d Change tests against all scope to base scope as all is now used as a finder alias 2008-04-30 00:25:52 -05:00
David Heinemeier Hansson
0a6980f2dc Let Base.all use conditions etc like first/last 2008-04-28 13:27:52 -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
David Dollar
6c1c16bfd9 Fixes a subtle bug when using symbols for key definitions in habtm associations 2008-04-23 21:02:00 +12:00
Joshua Bates
b6aa0e13b4 Fix include? on has_many collections with finder_sql to fall back to Array include? rather than try to use SQL.
[#18 state:resolved]
2008-04-23 20:18:09 +12:00
Frederick Cheung
ae51013c3f Provide data for the key column otherwise adding a unique index will fail. [#30 state:closed] 2008-04-23 14:24:20 +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
Joshua Peek
46ab7422d9 Use define_callbacks helper for ActiveRecord validations. 2008-04-20 11:45:44 -05:00
Ian White
82b4faf812 Fix migrations when migrating to a specified version number with a fresh database [#1 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-04-17 13:43:47 -05:00
Michael Koziarski
2e74177d0b Revert "Ensure that save on child object fails for invalid belongs_to association. Closes #11555. [rubyruy]"
This reverts commit c67e985994362290308073ed2793dd8e7f2a76db.
2008-04-11 16:04:11 +12:00
Pratik Naik
c67e985994 Ensure that save on child object fails for invalid belongs_to association. Closes #11555. [rubyruy]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9247 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-10 13:48:43 +00: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
Rick Olson
78c2d9fc22 ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 [kamal]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9243 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-08 05:20:33 +00:00
Josh Peek
4b68982f64 Improve ActiveRecord::Base#table_name unit tests for nested classes. Closes #10289. [scott_willson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-07 19:44:37 +00:00
Pratik Naik
4f39382a2f Ensure that respond_to? considers dynamic finder methods. Closes #11538. [floehopper]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 22:26:15 +00:00
Pratik Naik
5b822aca4b Split associations_test.rb into multiple files based on association type. [Pratik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 03:01:09 +00:00
Pratik Naik
7ddc8f2e1b Ensure that save on parent object fails for invalid has_one association. Closes #10518. [Pratik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 02:32:51 +00:00
Pratik Naik
f6b12c11cd Refactor HasManyThroughAssociation to inherit from HasManyAssociation. Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 00:27:12 +00:00
Pratik Naik
15d88885ee Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-05 16:25:48 +00:00
Michael Koziarski
36b8073ff5 Make HABTM#create behave the same as << with after_add callbacks. Closes #11374 [freels]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 14:37:22 +00:00
Michael Koziarski
50538fb524 Don't double include DISTINCT when the user has already specified it. Closes #11502 [kenneth.kalmer]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9223 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 12:06:22 +00:00
Rick Olson
d450ac4459 Tweak ActiveRecord::Base#to_json to include a root value in the returned hash: {post: {title: ...}} [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 20:09:45 +00:00
Rick Olson
e223216e9a Add efficient #include? to AssociationCollection (for has_many/has_many :through/habtm). [stopdropandrew]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 18:27:22 +00:00
Jeremy Kemper
300c927b6c Ruby 1.9 compat: force encoding for binary comparison tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9193 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:58:52 +00:00
Jeremy Kemper
ba8e0a846f Ruby 1.9 compat: work around YAML serialization error exposed by validations tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:46:40 +00:00
Jeremy Kemper
c3df9bfad2 Ruby 1.9 compat: delete DEFAULTS key from Hash not Omap array
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9191 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:33:16 +00:00
Jeremy Kemper
e4e3df8ef8 PostgreSQL: create_ and drop_database support. Closes #9042.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9182 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 05:01:10 +00:00
Jeremy Kemper
0a2e980ddd Fix migration test when run in GMT zone. Closes #11477 [thechrisoshow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9175 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 00:28:40 +00:00
Pratik Naik
92cd8811aa Ensure that validates_uniqueness_of works with with_scope. Closes #9235. [nik.wakelin, cavalle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9168 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 12:57:47 +00:00
Jeremy Kemper
df0d56c1f6 Force timestamp update
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9162 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 03:57:25 +00:00
Jeremy Kemper
c52771e7a0 Fix case-sensitive validates_uniqueness_of. Closes #11366 [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9160 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:50:07 +00:00
Jeremy Kemper
97019f9f5a Partial updates play nice with updated_at/on timestamps
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9159 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:49:57 +00:00
Jeremy Kemper
3aaf60def8 Add :message option to validates_numericality_of. Closes #11456 [miloops, mdempfle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:49:31 +00:00