• Home
  • Company
  • Services
  • Solutions
  • Our Work
  • Resources
  • Blogs
  • Contact
  • Overview
  • Alliances
  • Testimonials
  • Careers
  • Clients
  • Overview
  • Web Development
  • Mobile Development
  • IT Services
  • Web Promotion
  • Overview
  • CMS
  • Community Server
  • Dedicated Team
  • Kentico CMS
  • Overview
  • Web Development
  • Mobile Development
  • Internet Marketing
  • Overview
  • Case Studies
  • White Paper
  • Presentations
Anubavam Logo

Run Rails App without DB Connection

One of my co rails developer asked me how to disable DB connection when the rails application loads. Before you understand, ask yourself why you want to disable a database when rails app load.  Some of the application might just deal with other web services – such as twitter apps.  They might never need the database.  Let’s look at how to disable the database when the rails application load. 

Step 1:

#config/environment.rb

require File.join(File.dirname(__FILE__), 'boot')

Step 2:

class MyInitializer < Rails::Initializer

  def initialize_database

    if configuration.frameworks.include?(:active_record)

      ActiveRecord::Base.configurations = configuration.database_configuration

      ## uncomment the next line to automatically establish the connection

      # ActiveRecord::Base.establish_connection

    end

  end

end

Step 3:

#now, instead of `Rails::Initializer.run ...` do this 

MyInitializer.run do |config|

  # ...

end

Easy huh!   Go ahead and  run your rails application without Database Connection.

  • bala's blog
  • Login or register to post comments

Popular Tags

Applications cms migration Best 10 Apps IT Marketing adobe-air Apps Adobe Air open-source Air apps Top 10 Apps Marketing news drupal cms tips ria cms wordpress migration eSkyguide BDM joomla cms
more tags

Recent blog posts

  • Popular Adobe AIR Applications
  • Reap rich benefits in drupal and wordpress cms migration
  • eSkyguide Review by Aviation week
  • 13 Cool features in Adobe Air 2.0 Beta
  • Run Rails App without DB Connection
  • Twelve reasons why use CakePHP for web development
  • J2EE Open Source Enterprise Content Management Software - Jahia
  • Collection of rich internet application frameworks
  • Few tips before building your online community
  • Top Python Web frameworks
more

Company
  Alliances
  Testimonials
  Careers
  Clients
Services
  Web Development
    Rich Internet Application
    Custom Web Applications
    Online Community Development
  Mobile Application Development
    iPhone Application Development
    Android Application Development
    Blackberry Application Development
  IT Services
    VB Migration
    VB Conversion
    VB to J2EE
    Re-Engineering
    Web Enabled legacy Systems
  Web Promotion
  Offshore Outsourcing
Solutions
  CMS
  Community Server
  Dedicated Team
  Kentico CMS
  Search Engine Marketing
  CRM
  Application Assessment
Our Work
  Web Development Showcase
  Mobile Development Showcase
  SEO Internet Marketing Showcase
Resources
  Case Studies
  White Paper
  Presentations
Products
Site Map
Blogs
Contact

Get a Quote

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.
Valid XHTML 1.0 Transitional

Copyrights © 2009 Anubavam LLC. All rights reserved.

info@anubavam.com