1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Set a high default salary within the validation range

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@217 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2004-12-19 11:44:59 +00:00
parent 87b0d72fe6
commit a2130c22d7
5 changed files with 5 additions and 5 deletions

View file

@ -36,7 +36,7 @@ CREATE TABLE `topics` (
CREATE TABLE `developers` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) default NULL,
`salary` int(11) NULL,
`salary` int(11) default 70000,
PRIMARY KEY (`id`)
);

View file

@ -29,7 +29,7 @@ CREATE TABLE developers_projects (
CREATE TABLE developers (
id serial,
name character varying(100),
salary integer,
salary integer DEFAULT 70000,
PRIMARY KEY (id)
);
SELECT setval('developers_id_seq', 100);

View file

@ -33,7 +33,7 @@ CREATE TABLE 'topics' (
CREATE TABLE 'developers' (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' TEXT DEFAULT NULL,
'salary' INTEGER NULL
'salary' INTEGER 70000
);
CREATE TABLE 'projects' (

View file

@ -41,7 +41,7 @@ CREATE TABLE developers (
CREATE TABLE projects (
id int NOT NULL IDENTITY(1, 1),
name varchar(100) default NULL,
salary int default NULL,
salary int default 70000,
PRIMARY KEY (id)
);

View file

@ -351,7 +351,7 @@ class ValidationsTest < Test::Unit::TestCase
def test_throw_away_typing
d = Developer.create "name" => "David", "salary" => "100,000"
assert !d.valid?
assert_not_equal "100,000", d.salary
assert_equal 100, d.salary
assert_equal "100,000", d.salary_before_type_cast
end
end