I have found on numerous occasions that I need to disable certain plugin functionality if running a generator / rake db:migrate etc.
An easy way to disable certain functionality follows:
def method_that_shouldnt_be_run_in_migrations_or_generators # Return if we are using a generator or migrations script = File.basename($0) return if (script == 'generate') || (script == 'rake' && ARGV[0] =~ /migrate$/) end
1 comment so far ↓
I posted about this as well “here”:http://www.darkliquid.co.uk/2006/9/22/rails-code-that-doesn-t-get-executed-for-generations-and-migrations
Leave a Comment