The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Disabling plugin code in generators/migrations

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jamie Hill

Posts: 161
Nickname: jamie007
Registered: Nov, 2006

Jamie Hill is Managing Director of SonicIQ Limited in the UK specialising in XHTML, CSS and Rails.
Disabling plugin code in generators/migrations Posted: Nov 21, 2006 3:38 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jamie Hill.
Original Post: Disabling plugin code in generators/migrations
Feed Title: The Lucid
Feed URL: http://feeds.feedburner.com/thelucid
Feed Description: Lightweight ramblings and tips on Ruby and Rails.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jamie Hill
Latest Posts From The Lucid

Advertisement

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

Read: Disabling plugin code in generators/migrations

Topic: Gr.egario.us Done Right Previous Topic   Next Topic Topic: Rails vs Seaside From a Java Developer

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use