Hi, I''ve copied my working rails application (build on 0.12.1) on another PC where I''ve installed Rails 0.13.1 and I''m using postgres 8.0.1 On the new installation, I get the following error message while I try to access the main page :maximum must be a nonnegative Integer I''ve added in a table model some validations like: validates_length_of :name, :maximum => Client.columns[14].limit, :message => "Max is #{Client.columns[14].limit} I use this behaviour to keep syncronized the DB field length and the application''s check. Using a breakpoint I''ve found out the limit property of some elements in the columns Array is nil. That''s why I get the error, but I''m wondering why it''s nil if the db columns is still varchar(n) (n is a positive Integer changing for each column)! Someone has a suggestion? Thanks, Enrico -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
> That''s why I get the error, but I''m wondering why it''s nil if the db > columns is still varchar(n) (n is a positive Integer changing for each > column)!Are you sure it''s a varchar column causing the problem? Do you know if your db adapter actually sets a limit for all data types (Date, Time, etc.)?
Sorry for the delay, I wasn''t on this project.> Are you sure it''s a varchar column causing the problem?yes I am, when I remove the validate_lenght_of no more error on that line! I get another error on another "validate_lenght_of" line. Each referring to a varchar postgres column.> Do you know if your db > adapter actually sets a limit for all data types (Date, Time, etc.)?I''ve just copied my rails application on a brand new system, where I''ve update rails on the last gem. Also I''ve installed the postgres adapter from gems. But postgres gem failed... sudo gem install -r postgres Password: Attempting remote installation of ''postgres'' Building native extensions. This could take a while... ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/postgres-0.7.1 for inspection. ruby extconf.rb install -r postgres\nchecking for cygwin32_socket() in -lwsock32... no checking for socket() in -lsocket... no checking for gethostbyname() in -linet... no checking for gethostbyname() in -lnsl... yes checking for sys/un.h... yes checking for socket()... yes checking for hsterror()... no checking for gethostname()... yes checking for PQsetdbLogin() in -lpq... no Could not find PostgreSQL libraries: Makefile not created Results logged to /usr/local/lib/ruby/gems/1.8/gems/postgres-0.7.1/gem_make.out so I''ve tried with postgres-pr ... successfully ~$ sudo gem install -r postgres-pr Attempting remote installation of ''postgres-pr'' Successfully installed postgres-pr-0.4.0 what gem are you using to talk with postgres? someone is experiencing the ":maximum must be a nonnegative Integer" error after a rails update? -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
Breakpointing carefully, I''ve noticed on the first PC Client.columns[0] is the first column after the id... and the "id" is placed within Client.columns[14] On the PC with the updated Rails Client.columns[0] is the "id"!!! And the Client.columns[14] is the last column of the table. So the error was right, and I was wrong while assuming the same columns layout on the two PCs. I will chek if updating the last rails release on the "old" PC solve this situation. -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
> I will chek if updating the last rails release on the "old" PC solve > this situation.it was... so it''s solved :-) -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke