Filed a ticket for bogus Ruby produced via: rake db_schema_dump http://dev.rubyonrails.org/ticket/3232 I''d appreciate it if someone could verify against PostgreSQL 8.0.x -- -- Tom Mornini
Charles M. Gerungan
2005-Dec-15 08:52 UTC
Re: Migrations bug with Rails 1.0, PostgreSQL 8.1?
On 14-dec-2005, at 22:06, Tom Mornini wrote:> Filed a ticket for bogus Ruby produced via: > > rake db_schema_dump > > http://dev.rubyonrails.org/ticket/3232This is expected behavior. If you want to set default values, the Rails way is to use a filter: class Model < ActiveRecord::Base protected before_create :set_default_values def.set_default_value self.updated_at = Time.now end end However, in the case of updated_at/on created_at/on, Rails will automagically populate those if present. -- Regards, Charles.
What does this have to do with: rake db_schema_dump producing non-functional Ruby code that breaks tests and doesn''t correctly instantiate the database? I find it rather hard to believe that broken code generation is expected behavior, or that the basis for the new DB migrations functionality is supposed to misassign default column value settings? -- -- Tom Mornini On Dec 15, 2005, at 3:52 AM, Charles M. Gerungan wrote:> On 14-dec-2005, at 22:06, Tom Mornini wrote: > >> Filed a ticket for bogus Ruby produced via: >> >> rake db_schema_dump >> >> http://dev.rubyonrails.org/ticket/3232 > > This is expected behavior. > > If you want to set default values, the Rails way is to use a filter: > > class Model < ActiveRecord::Base > > protected > before_create :set_default_values > > def.set_default_value > self.updated_at = Time.now > end > end > > However, in the case of updated_at/on created_at/on, Rails will > automagically populate those if present. > > -- > Regards, Charles. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails