tag:blogger.com,1999:blog-1502761093196431512.post7756752638218558415..comments2024-01-06T14:58:41.477+11:00Comments on Ruby-coloured glasses: Rails gotchas: Data Migrations conflict with validationsTaryn Easthttp://www.blogger.com/profile/00647732421144825421noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-1502761093196431512.post-125684897385623092008-05-08T12:12:00.000+10:002008-05-08T12:12:00.000+10:00Cool. these are some good options for the future.I...Cool. these are some good options for the future.<BR/><BR/>In this particular case I wanted to change past migrations so they "kept working" with as little pain... er change as possible ;)<BR/><BR/>Which is why save(false) was good in this instance.<BR/><BR/>Hopefully we won't need to do this ever again... but life being what it's like, it's great to hear there are even more options open that will keep pace with future changes.<BR/><BR/>Thanks heaps!Taryn Easthttps://www.blogger.com/profile/00647732421144825421noreply@blogger.comtag:blogger.com,1999:blog-1502761093196431512.post-24770111847391506752008-05-07T02:42:00.000+10:002008-05-07T02:42:00.000+10:00There are other options. One is to build and execu...There are other options. One is to build and execute the INSERT statement yourself instead of using ActiveRecord. This is the most future-proof solution, and you can easily write a helper to do this.<BR/><BR/>Another option is to define the model class in the migration without the validations, so that it overrides the definition in the models directory. A simple "class Foo < ActiveRecord::Base; end" will do the trick.Anonymousnoreply@blogger.com