in Education by
Now that Rails 3 beta is out, I thought I'd have a look at rewriting an app I have just started work on in Rails 3 beta, both to get a feel for it and get a bit of a head-start. The app uses MongoDB and MongoMapper for all of its models and therefore has no need for ActiveRecord. In the previous version, I am unloading activerecord in the following way: config.frameworks -= [ :active_record ] # inside environment.rb In the latest version this does not work - it just throws an error: /Library/Ruby/Gems/1.8/gems/railties-3.0.0.beta/lib/rails/configuration.rb:126:in `frameworks': config.frameworks in no longer supported. See the generated config/boot.rb for steps on how to limit the frameworks that will be loaded (RuntimeError) from *snip* Of course, I have looked at the boot.rb as it suggested, but as far as I can see, there is no clue here as to how I might go about unloading AR. The reason I need to do this is because not only is it silly to be loading something I don't want, but it is complaining about its inability to make a DB connection even when I try to run a generator for a controller. This is because I've wiped database.yml and replaced it with connection details for MongoDB in order to use this gist for using database.yml for MongoDB connection details. Not sure why it needs to be able to initiate a DB connection at all just to generate a controller anyway.... Is anyone aware of the correct Rails 3 way of doing this? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I'm going by this from reading the source, so let me know if it actually worked. :) The rails command that generates the application template now has an option -O, which tells it to skip ActiveRecord. If you don't feel like rerunning rails, you should check the following in your existing app: Check that your config/application.rb doesn't have require 'rails/all' or require "active_record/railtie". Instead, for a standard Rails setup without ActiveRecord, it should have only the following requires: require File.expand_path('../boot', __FILE__) require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie" require "sprockets/railtie" # Auto-require default libraries and those for the current Rails environment. Bundler.require :default, Rails.env If, in config/application.rb, you are using the config.generators section, make sure it doesn't have the line g.orm :active_record. You can set this explicitly to nil, if you want, but this should be the default when g.orm is completely omitted. Optional, but in your Gemfile, remove the gem line that loads the module for your database. This could be the line gem "mysql" for example.

Related questions

0 votes
    ActiveRecord 3.2.14 I want to use ActiveRecord in a non-Rails Ruby project. I want to have ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 3, 2022 in Education by JackTerrance
0 votes
    I'm upgrading an application from Rails 3.0 to 3.1 and found the following error showing up in my ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I am trying to build a Rails 3.1 app in which users can preview individual pages of documents or ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    I moved a web app that was using 1.8.7 to 1.9.2 and now I keep getting incompatible character ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I'd like to add a CMS and blog to a web app. One that won't get in the way. There's ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    Does anyone know how to add another folder to the asset pipeline in Rails 3.1? I'd like to serve app/assets/ ... an asset path, in your application.rb file: config.assets.paths...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    I have a Rails app that mounts 3 engines. Each engines has their own db migrations with timestamp in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I'm running Rails 3.1.1, RSpec 2.7.0 and HAML 3.1.3. Say I have the following view ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I made a basic rails app with a simple pages controller with an index function and when I load the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I'm using ActionMailer in my application and I want to use localized views for email templates. It seems ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I want to make a copy of an ActiveRecord object, changing a single field in the process (in addition ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    I want to make a copy of an ActiveRecord object, changing a single field in the process (in addition ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    Is it possible to use an attribute of a child to group a query? Post.find(:all, :include => [ ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    When I'm trying to get all Audio songs by specified artist, I get error: ActiveRecord::StatementInvalid: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    To configure the admin settings of my app I made a Admin controller and a AdminConfig model. The Admin ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
...