Hi group, I have a line of code in environment.rb that cannot be run during a rake db:migrate, as it depends on some tables being present. I need to find a way to enclose this line in a check for db:migrate. I know how to check if we're in a rake task with: unless defined?(Rake) # do stuff, but skip when run from rake tasks end How can I take this further to make check if I'm running the rake db:migrate task? Thanks, -H
on 2009-02-05 22:33
on 2009-02-05 22:55
Excuse me, the code I need to wrap around the check is on ApplicationController. Still, any ideas?
on 2009-02-05 23:23
There is a model class method like table_exists? That you can use to check ifthe table exists and then only run the code if it does
on 2009-02-05 23:26
Thanks! That would work, for now. I still have the itch though. If anyone knows, do tell. Thanks again, -H