Commit Graph

2233 Commits

Author SHA1 Message Date
Tarmo Tänav
c1531ae00d SQLite: rename_column raises if the column doesn't exist.
[#622 state:resolved]
2008-07-14 22:58:22 -07:00
Tarmo Tänav
8c91b767c0 Fixed postgresql limited eager loading for the case where scoped :order was present 2008-07-14 22:44:58 -07:00
Tiago Macedo
76df9fa068 Fix integer quoting issues in association preload. [#602 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 23:34:19 +01:00
Gabe da Silveira
cd9b24286a Add assert_sql helper method to check for specific SQL output in Active Record test suite. [#325 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 23:22:39 +01:00
Tarmo Tänav
07578ac855 Fixed mysql change_column_default to not make the column always nullable.
Also added change_column_null to both mysql and sqlite to keep the api features closer to postgresql.

[#617 state:resolved]
2008-07-14 12:42:01 -07:00
Tarmo Tänav
8f72bc92e2 Fixed test_rename_nonexistent_column for PostgreSQL
Also fixed ability to run migration_test.rb alone

[#616 state:resolved]
2008-07-14 12:22:27 -07:00
Jeremy Kemper
c760dbfd31 PostgreSQL: don't dump :limit => 4 for integers 2008-07-14 11:59:46 -07:00
Jeremy Kemper
cdf0f1aa2e Faster and clearer value_to_boolean 2008-07-14 11:41:56 -07:00
David Heinemeier Hansson
3037022789 Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334 status:committed] 2008-07-14 10:12:54 -05:00
Sebastian A. Espindola
0176e6adb3 Added db:charset support to PostgreSQL. [#556 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 04:11:52 +01:00
David Dollar
e0750d6a5c Add :accessible option to Associations for allowing mass assignments using hash. [#474 state:resolved]
Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate
ActiveRecord models.

class Post < ActiveRecord::Base
  belongs_to :author,   :accessible => true
  has_many   :comments, :accessible => true
end

post = Post.create({
  :title    => 'Accessible Attributes',
  :author   => { :name => 'David Dollar' },
  :comments => [
    { :body => 'First Post!' },
    { :body => 'Nested Hashes are great!' }
  ]
})

post.comments << { :body => 'Another Comment' }

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:53:21 +01:00
Jason Dew
c6f397c5ce Add block syntax to HasManyAssociation#build. [#502 state:resolve]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:24:12 +01:00
Rhett Sutphin
d72c66532f Make fixture accessors work when fixture name is not same as the table name. [#124 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:01:52 +01:00
Micah Wedemeyer
5e2e1ed9ff Ensure MysqlAdapter allows SSL connection when only sslca is supplied. [#253 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-11 23:52:41 +01:00
Cheah Chu Yeow
ce4a1bb853 Remove some Symbol#to_proc usage in runtime code. [#484 state:resolved] 2008-07-09 10:42:30 -07:00
Jeremy Kemper
11252e35b1 Boolean type casting creates fewer objects 2008-07-09 10:42:30 -07:00
Daniel Guettler
84af99e78d Ensure NamedScope#build/create/create!/new works as expected when named scope has hash conditions. [Daniel Guettler, Pratik Naik] [#419 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-09 14:09:17 +01:00
Chris Cherry
124d1016fa Allow Infinity (1.0/0.0) to pass validates_numericality_of. [#354 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-09 13:15:07 +01:00
Brad Greenlee
afa0c7f728 Add support for :primary_key option to has_one as well as has_many so that a key other than the default primary key can be used for the association
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-06 20:25:10 +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 Lowenfels
87fbcaa622 Add :tokenizer option to validates_length_of. [#507 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-04 01:31:39 +01:00
Lucas Carlson
d20e8dd220 Changing order of equality because comparing certain objects with false raises an error.
>> require 'md5'
=> true
>> MD5.new("Asds") == false
TypeError: can't convert false into String
	from (irb):2:in `=='
	from (irb):2
>> false == MD5.new("Asds")
=> false
2008-07-02 21:24:48 -07:00
Pratik Naik
474d425382 Ensure AssociationCollection#size considers all unsaved record. [#305 state:resolved] [sds]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-02 03:17:33 +01:00
Tim Chater
1415df8f49 Dirty: recognize when an integer changes from zero to blank. [#433 state:resolved] 2008-06-27 21:31:06 -07:00
Pratik Naik
9a25315076 Add extra hash conditions tests for named_scope 2008-06-28 01:57:32 +01:00
Pratik Naik
cd994eff9a Allow conditions on multiple tables to be specified using hash.
Examples:

  User.all :joins => :items, :conditions => { :age => 10, :items => { :color => 'black' } }
  Item.first :conditions => { :items => { :color => 'red' } }

Note : Hash key in :conditions is referring to the actual table name or the alias defined in query.
2008-06-28 01:27:51 +01:00
Jeremy Kemper
4498aad4ac MySQL: treat integer with :limit => 11 as a display width, not byte size, for backward-compatibility. 2008-06-27 01:07:22 -07:00
Jan De Poorter
b2b761166d Make sure associated has_many/habtm objects get saved even when :validate => false is used. [#486 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-27 03:02:13 +01:00
Pratik Naik
5ca7d01eca Cache sanitized conditions in reflection object for associations 2008-06-27 02:47:38 +01:00
Andre Arko
0b12da44aa Extract owner_quoted_id so it can be overridden. [#292 state:committed] 2008-06-25 19:04:09 -07:00
Jeremy Kemper
c397260577 Performance: minor Column#text? and #number? speedups 2008-06-25 18:55:55 -07:00
Jeremy Kemper
071fe79279 Include cache key in ModelName 2008-06-24 22:07:09 -07:00
Jeremy Kemper
f6520b7dc7 Test for tinyint 2008-06-23 23:42:06 -07:00
Jeremy Kemper
290e1e2fc5 Treat any limit > 4 as bigint 2008-06-23 18:16:03 -07:00
Tarmo Tänav
baddea95e1 Always treat integer :limit as byte length. [#420 state:resolved] 2008-06-22 20:42:31 -07:00
Daniel Morrison
3610997ba3 Partial updates don't update lock_version if nothing changed. [#426 state:resolved] 2008-06-22 20:33:43 -07:00
Mark Catley
0fd3e4cd2b Fix column collision with named_scope and :joins. [#46 state:resolved] 2008-06-22 19:21:15 -07:00
Jeremy Kemper
a210f50361 Oops, already had a postgresql_version method! 2008-06-22 18:50:19 -07:00
ian
3532eaf92a Only use DROP ... IF EXISTS for PostgreSQL 8.2 or later. [#400 state:resolved] 2008-06-22 18:31:47 -07:00
Michael Raidel
f94600bdaf ActiveRecord::Migrator#run records version-state after migrating. [#369 state:resolved] 2008-06-22 18:16:17 -07:00
Tarmo Tänav
1afae84ab2 Fixed that scopes defined with a string name could not be composed 2008-06-22 17:26:00 -07:00
Jeremy Kemper
43cbcb10ae nix extra newline 2008-06-22 16:22:23 -07:00
Jeremy Kemper
a73ac98123 Changelog for 509374e 2008-06-22 16:21:08 -07:00
Tarmo Tänav
509374ebe2 Named bind variables can now be used with postgresql-style typecasts
For example :conditions => ['stringcol::integer = :var', { :var => 10 }]
will no longer raise an exception about ':integer' having a missing value.
2008-06-22 16:16:06 -07:00
Diego Algorta
2e1b56c937 MySQL: rename_column preserves default values. [#466 state:resolved] 2008-06-22 15:21:11 -07:00
Jeremy Kemper
a02d672cd7 Horo rdoc template 2008-06-22 10:38:25 -07:00
rick
10c581a6de fix merge 2008-06-19 09:59:36 -07:00
Jeremy Kemper
231c2c5709 Update Rakefiles to connect to wrath as current user. Use ssh config to set a different user. 2008-06-18 19:58:26 -07:00
Jeremy Kemper
e328bdaab6 Make Base.merge_conditions public 2008-06-17 16:01:48 -07:00
George Ogata
bc4a2f156b Fix observers that use after_find. [#375 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-17 19:45:18 +01:00