Richard White
2007-Nov-27 04:23 UTC
Does Rails 2.0 *require* a db? Sure seems that way ...
I do a number of protoype apps in Rails and up until 2.0 I haven''t had any issues running them without a DB. I''m running a naked Rails 2.0 app with only a few views, no ActiveRecord models and using the default session store (zee Cookied one): ------ Processing EventsController#index (for 127.0.0.1 at 2007-11-26 20:07:29) [GET] Session ID: BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--b922ebe60d92900bcef0795360cd Parameters: {"action"=>"index", "controller"=>"events"} Mysql::Error (#42000Incorrect database name ''prototype.com_development''): /vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:523:in `read'' /vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:153:in `real_connect'' /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:471:in `connect'' /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:165:in `initialize'' /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `new'' /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `mysql_connection'' /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `send'' /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `connection='' /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection'' /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'' /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'' /vendor/rails/actionpack/lib/action_controller/caching.rb:668:in `perform_action'' /vendor/rails/actionpack/lib/action_controller/base.rb:513:in `send'' /vendor/rails/actionpack/lib/action_controller/base.rb:513:in `process_without_filters'' /vendor/rails/actionpack/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' /vendor/rails/actionpack/lib/action_controller/session_management.rb:123:in `process'' /vendor/rails/actionpack/lib/action_controller/base.rb:377:in `process'' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:171:in `handle_request'' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in `dispatch'' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in `dispatch'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:78:in `process'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:in `synchronize'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:76:in `process'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:618:in `process_client'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:in `each'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:617:in `process_client'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in `initialize'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in `new'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:736:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:in `initialize'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:in `new'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb:720:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:271:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in `each'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/configurator.rb:270:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:127:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/command.rb:211:in `run'' c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:243 /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'' /vendor/rails/railties/lib/commands/servers/mongrel.rb:64 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'' /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'' /vendor/rails/railties/lib/commands/server.rb:39 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 ----- WTF Mates? Here''s the oh so exciting environment.rb: -- environment.rb -- # Specifies gem version of Rails to use when vendor/rails is not present #RAILS_GEM_VERSION = ''1.2.5'' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), ''boot'') Rails::Initializer.run do |config| config.action_controller.session = { :session_key => "_prototype", :secret => "not so secretive" } end ----- Anyone have any ideas on why it needs a db? Thanks Rich -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nope. Just do this in your environment.rb: config.frameworks -= [:active_record, :action_web_service, :action_mailer] All will then be well (or, at least it works for me :) On Nov 26, 2007, at 8:23 PM, Richard White wrote:> > I do a number of protoype apps in Rails and up until 2.0 I haven''t had > any issues running them without a DB. > > I''m running a naked Rails 2.0 app with only a few views, no > ActiveRecord > models and using the default session store (zee Cookied one): > > ------ > > Processing EventsController#index (for 127.0.0.1 at 2007-11-26 > 20:07:29) > [GET] > Session ID: > BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo% > 0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--b922ebe60d92900bcef0795360cd > Parameters: {"action"=>"index", "controller"=>"events"} > > > Mysql::Error (#42000Incorrect database name > ''prototype.com_development''): > /vendor/rails/activerecord/lib/active_record/vendor/mysql.rb: > 523:in > `read'' > /vendor/rails/activerecord/lib/active_record/vendor/mysql.rb: > 153:in > `real_connect'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/mysql_adapter.rb:471:in > `connect'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/mysql_adapter.rb:165:in > `initialize'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/mysql_adapter.rb:88:in > `new'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/mysql_adapter.rb:88:in > `mysql_connection'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/abstract/connection_specification.rb:291:in > `send'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/abstract/connection_specification.rb:291:in > `connection='' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/abstract/connection_specification.rb:259:in > `retrieve_connection'' > /vendor/rails/activerecord/lib/active_record/ > connection_adapters/abstract/connection_specification.rb:78:in > `connection'' > /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in > `cache'' > /vendor/rails/actionpack/lib/action_controller/caching.rb:668:in > `perform_action'' > /vendor/rails/actionpack/lib/action_controller/base.rb:513:in > `send'' > /vendor/rails/actionpack/lib/action_controller/base.rb:513:in > `process_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:685:in > `process_without_session_management_support'' > /vendor/rails/actionpack/lib/action_controller/ > session_management.rb:123:in > `process'' > /vendor/rails/actionpack/lib/action_controller/base.rb:377:in > `process'' > /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: > 171:in > `handle_request'' > /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: > 115:in > `dispatch'' > /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: > 126:in > `dispatch_cgi'' > /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in > `dispatch'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/rails.rb:78:in > `process'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/rails.rb:76:in > `synchronize'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/rails.rb:76:in > `process'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:618:in > `process_client'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:617:in > `each'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:617:in > `process_client'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:736:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:736:in > `initialize'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:736:in > `new'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:736:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:720:in > `initialize'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:720:in > `new'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel.rb:720:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/configurator.rb:271:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/configurator.rb:270:in > `each'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/configurator.rb:270:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/ > mongrel_rails:127:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ > mongrel/command.rb:211:in > `run'' > c:/dev/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/ > mongrel_rails:243 > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 489:in > `load'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 489:in > `load'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 342:in > `new_constants_in'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 489:in > `load'' > /vendor/rails/railties/lib/commands/servers/mongrel.rb:64 > c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: > 27:in > `gem_original_require'' > c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: > 27:in > `require'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 496:in > `require'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 342:in > `new_constants_in'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 496:in > `require'' > /vendor/rails/railties/lib/commands/server.rb:39 > c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: > 27:in > `gem_original_require'' > c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: > 27:in > `require'' > script/server:3 > > ----- > > WTF Mates? Here''s the oh so exciting environment.rb: > > -- environment.rb -- > > # Specifies gem version of Rails to use when vendor/rails is not > present > #RAILS_GEM_VERSION = ''1.2.5'' unless defined? RAILS_GEM_VERSION > > # Bootstrap the Rails environment, frameworks, and default > configuration > require File.join(File.dirname(__FILE__), ''boot'') > > Rails::Initializer.run do |config| > config.action_controller.session = { :session_key => "_prototype", > :secret => "not so secretive" } > end > > ----- > > Anyone have any ideas on why it needs a db? Thanks > > Rich > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Richard White
2007-Nov-27 05:00 UTC
Re: Does Rails 2.0 *require* a db? Sure seems that way ...
Steve Ross wrote:> Nope. Just do this in your environment.rb: > > config.frameworks -> [:active_record, :action_web_service, :action_mailer] > > All will then be well (or, at least it works for me :)That works and seems like a good practice that I''ll continue. Still confused in the silent change as this wasn''t required pre-2.0 if you simply never used those frameworks. Moving on though. Thanks for the help, Steve. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-27 11:19 UTC
Re: Does Rails 2.0 *require* a db? Sure seems that way ...
On 27 Nov 2007, at 05:00, Richard White wrote:> > Steve Ross wrote: >> Nope. Just do this in your environment.rb: >> >> config.frameworks ->> [:active_record, :action_web_service, :action_mailer] >> >> All will then be well (or, at least it works for me :)I''ve got a small app which doesn''t use active_record I did have to comment out #require ''test_help'' in my test_helper.rb (since that requires fixtures, which in turn needs ActiveRecord) (and then copied into my test_helper.rb the bits from test_help which were relevant. I also had to edit environment.rb to add module Rails class Initializer def load_observers if configuration.frameworks.include?(:active_record) ActiveRecord::Base.instantiate_observers end end end end Fred>> > > That works and seems like a good practice that I''ll continue. Still > confused in the silent change as this wasn''t required pre-2.0 if you > simply never used those frameworks. Moving on though. > > Thanks for the help, Steve. > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---