Hello, I got the following issue and I do not know how to resolve it: #1. created parent class (AccountExtended) for some my models (lib/classes_lib.rb): class AccountExtended < ActiveRecord::Base def self.findByAccount end end #2. created model Country: require ''lib/classes_lib'' class Country < AccountExtended end #3. and added a test controller what shows an issue (view_controller.rb): class ViewController < ApplicationController def index @countries = Country.find(:all) end end index.rhtml: <table> <% @countries.each do |c| -%> <tr><td><%= c.full_name %></td></tr> <% end -%> </table> (it is simply a skeleton) then I start webrick, refresh page in my browser and see countries list. After second refresh a browser''s page I get: ------------------------------------------------------ NameError in ViewController#index uninitialized constant AccountExtended |RAILS_ROOT: script/../config/..| Application Trace <http://localhost:3000/view#> | Framework Trace <http://localhost:3000/view#> | Full Trace <http://localhost:3000/view#> |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' #{RAILS_ROOT}/app/models/country.rb:2 app/controllers/view_controller.rb:3:in `index''| |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in `require_or_load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in `depend_on'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in `require_dependency'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' script/server:3| |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' #{RAILS_ROOT}/app/models/country.rb:2 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in `require_or_load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in `depend_on'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in `require_dependency'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'' app/controllers/view_controller.rb:3:in `index'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' script/server:3| |This error occured while loading the following files: country.rb account_extended.rb --------------------------------------- | Please, can anybody explain me what I do wrongly ? Thanks. -- Vladimir Kurnavenkov -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5181 bytes Desc: S/MIME Cryptographic Signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/38cb6783/smime-0001.bin
just put your AR model in /app/models. at least that works for me (i didn''t try it otherwise, though) 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua>:> > Hello, > I got the following issue and I do not know how to resolve it: > #1. created parent class (AccountExtended) for some my models > (lib/classes_lib.rb): > class AccountExtended < ActiveRecord::Base > def self.findByAccount > end > end > > #2. created model Country: > require ''lib/classes_lib'' > class Country < AccountExtended > end > > #3. and added a test controller what shows an issue (view_controller.rb): > class ViewController < ApplicationController > def index > @countries = Country.find(:all) > end > end > > index.rhtml: > <table> > <% @countries.each do |c| -%> > <tr><td><%= c.full_name %></td></tr> > <% end -%> > </table> > > (it is simply a skeleton) > > then I start webrick, refresh page in my browser and see countries list. > After second refresh a browser''s page I get: > ------------------------------------------------------ > > > NameError in ViewController#index > > uninitialized constant AccountExtended > > |RAILS_ROOT: script/../config/..| > > Application Trace <http://localhost:3000/view#> | Framework Trace > <http://localhost:3000/view#> | Full Trace <http://localhost:3000/view#> > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > #{RAILS_ROOT}/app/models/country.rb:2 > app/controllers/view_controller.rb:3:in `index''| > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in > `load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in > `require_or_load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in > `depend_on'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in > `require_dependency'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in > `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in > `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6 > /lib/commands/servers/webrick.rb:59 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > script/server:3| > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > #{RAILS_ROOT}/app/models/country.rb:2 > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in > `load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in > `require_or_load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in > `depend_on'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in > `require_dependency'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in > `const_missing'' > app/controllers/view_controller.rb:3:in `index'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in > `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in > `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6 > /lib/commands/servers/webrick.rb:59 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > script/server:3| > > |This error occured while loading the following files: > country.rb > account_extended.rb > --------------------------------------- > | > > Please, can anybody explain me what I do wrongly ? > Thanks. > > -- > Vladimir Kurnavenkov > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- Michael Siebert <info@siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/94e4e520/attachment-0001.html
Michael Siebert wrote:> just put your AR model in /app/models. at least that works for me (i > didn''t try it otherwise, though)I have moved classes_lib.rb to /app/models, modified ''require'' and got the same error message :(> > 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua > <mailto:vladimir@psoft.od.ua>>: > > Hello, > I got the following issue and I do not know how to resolve it: > #1. created parent class (AccountExtended) for some my models > (lib/classes_lib.rb): > class AccountExtended < ActiveRecord::Base > def self.findByAccount > end > end > > #2. created model Country: > require ''lib/classes_lib'' > class Country < AccountExtended > end > > #3. and added a test controller what shows an issue > (view_controller.rb): > class ViewController < ApplicationController > def index > @countries = Country.find(:all) > end > end > > index.rhtml: > <table> > <% @countries.each do |c| -%> > <tr><td><%= c.full_name %></td></tr> > <% end -%> > </table> > > (it is simply a skeleton) > > then I start webrick, refresh page in my browser and see countries > list. > After second refresh a browser''s page I get: > ------------------------------------------------------ > > > NameError in ViewController#index > > uninitialized constant AccountExtended > > |RAILS_ROOT: script/../config/..| > > Application Trace <http://localhost:3000/view# > <http://localhost:3000/view#>> | Framework Trace > <http://localhost:3000/view#> | Full Trace > <http://localhost:3000/view#> > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport- > 1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > #{RAILS_ROOT}/app/models/country.rb:2 > app/controllers/view_controller.rb:3:in `index''| > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1 > /lib/active_support/dependencies.rb:131:in `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in > `load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1 > /lib/active_support/dependencies.rb:56:in `require_or_load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in > `depend_on'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport- > 1.3.1/lib/active_support/dependencies.rb:85:in `require_dependency'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport- > 1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack- > 1.12.5/lib/action_controller/base.rb:941:in > `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack- > 1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails- > 1.1.6/lib/webrick_server.rb:81:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails- > 1.1.6/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > script/server:3| > > |/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > #{RAILS_ROOT}/app/models/country.rb:2 > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in > `load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in > `require_or_load'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in > `depend_on'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in > `require_dependency'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in > `const_missing'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in > `const_missing'' > app/controllers/view_controller.rb:3:in `index'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5 > /lib/action_controller/base.rb:941:in `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack- > 1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails- > 1.1.6/lib/webrick_server.rb:81:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails- > 1.1.6/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > script/server:3| > > |This error occured while loading the following files: > country.rb > account_extended.rb > --------------------------------------- > | > > Please, can anybody explain me what I do wrongly ? > Thanks. > > -- > Vladimir Kurnavenkov > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > -- > Michael Siebert <info@siebert-wd.de <mailto:info@siebert-wd.de>> > > www.stellar-legends.de <http://www.stellar-legends.de> - > Weltraum-Browsergame im Alpha-Stadium > >------------------------------------------------------------------------ > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >-- Vladimir Kurnavenkov -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5181 bytes Desc: S/MIME Cryptographic Signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/c63d4aec/smime.bin
Vladimir Kurnavenkov wrote:> Michael Siebert wrote: > >> just put your AR model in /app/models. at least that works for me (i >> didn''t try it otherwise, though) > > > I have moved classes_lib.rb to /app/models, modified ''require'' and got > the same error message :(I have renamed classes_lib.rb -> app/models/account_extended.rb and now it is working :) but it is very strangely....> >> >> 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua >> <mailto:vladimir@psoft.od.ua>>: >> >> Hello, >> I got the following issue and I do not know how to resolve it: >> #1. created parent class (AccountExtended) for some my models >> (lib/classes_lib.rb): >> class AccountExtended < ActiveRecord::Base >> def self.findByAccount >> end >> end >> >> #2. created model Country: >> require ''lib/classes_lib'' >> class Country < AccountExtended >> end >> >> #3. and added a test controller what shows an issue >> (view_controller.rb): >> class ViewController < ApplicationController >> def index >> @countries = Country.find(:all) >> end >> end >> >> index.rhtml: >> <table> >> <% @countries.each do |c| -%> >> <tr><td><%= c.full_name %></td></tr> >> <% end -%> >> </table> >> >> (it is simply a skeleton) >> >> then I start webrick, refresh page in my browser and see countries >> list. >> After second refresh a browser''s page I get: >> ------------------------------------------------------ >> >> >> NameError in ViewController#index >> >> uninitialized constant AccountExtended >> >> |RAILS_ROOT: script/../config/..| >> >> Application Trace <http://localhost:3000/view# >> <http://localhost:3000/view#>> | Framework Trace >> >> |This error occured while loading the following files: >> country.rb >> account_extended.rb >> --------------------------------------- >> | >> >> Please, can anybody explain me what I do wrongly ? >> Thanks. >> >> -- >> Vladimir Kurnavenkov >> >> >> >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> >> >> >> -- >> Michael Siebert <info@siebert-wd.de <mailto:info@siebert-wd.de>> >> >> www.stellar-legends.de <http://www.stellar-legends.de> - >> Weltraum-Browsergame im Alpha-Stadium >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > >------------------------------------------------------------------------ > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >-- Vladimir Kurnavenkov -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5181 bytes Desc: S/MIME Cryptographic Signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/03a709dc/smime-0001.bin
now i know what went wrong... rails makes some assupmtions about class- and filenames. one is: a file in models camelized => model classname. so if the autoloader encounters a unknown classname (=constant), it knows in which file it finds that class. if it isnt there or has another name, it fails. 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua>:> > Vladimir Kurnavenkov wrote: > > > Michael Siebert wrote: > > > >> just put your AR model in /app/models. at least that works for me (i > >> didn''t try it otherwise, though) > > > > > > I have moved classes_lib.rb to /app/models, modified ''require'' and got > > the same error message :( > > I have renamed classes_lib.rb -> app/models/account_extended.rb and now > it is working :) > but it is very strangely.... > > > > >> > >> 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua > >> <mailto:vladimir@psoft.od.ua>>: > >> > >> Hello, > >> I got the following issue and I do not know how to resolve it: > >> #1. created parent class (AccountExtended) for some my models > >> (lib/classes_lib.rb): > >> class AccountExtended < ActiveRecord::Base > >> def self.findByAccount > >> end > >> end > >> > >> #2. created model Country: > >> require ''lib/classes_lib'' > >> class Country < AccountExtended > >> end > >> > >> #3. and added a test controller what shows an issue > >> (view_controller.rb): > >> class ViewController < ApplicationController > >> def index > >> @countries = Country.find(:all) > >> end > >> end > >> > >> index.rhtml: > >> <table> > >> <% @countries.each do |c| -%> > >> <tr><td><%= c.full_name %></td></tr> > >> <% end -%> > >> </table> > >> > >> (it is simply a skeleton) > >> > >> then I start webrick, refresh page in my browser and see countries > >> list. > >> After second refresh a browser''s page I get: > >> ------------------------------------------------------ > >> > >> > >> NameError in ViewController#index > >> > >> uninitialized constant AccountExtended > >> > >> |RAILS_ROOT: script/../config/..| > >> > >> Application Trace <http://localhost:3000/view# > >> <http://localhost:3000/view#>> | Framework Trace > >> > >> |This error occured while loading the following files: > >> country.rb > >> account_extended.rb > >> --------------------------------------- > >> | > >> > >> Please, can anybody explain me what I do wrongly ? > >> Thanks. > >> > >> -- > >> Vladimir Kurnavenkov > >> > >> > >> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > >> > >> > >> > >> > >> -- > >> Michael Siebert <info@siebert-wd.de <mailto:info@siebert-wd.de>> > >> > >> www.stellar-legends.de <http://www.stellar-legends.de> - > >> Weltraum-Browsergame im Alpha-Stadium > >> > >> > ------------------------------------------------------------------------ > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rails mailing list > >Rails@lists.rubyonrails.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > -- > Vladimir Kurnavenkov > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- Michael Siebert <info@siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/b386aa14/attachment.html
Michael Siebert wrote:> now i know what went wrong... > rails makes some assupmtions about class- and filenames. one is: a > file in models camelized => model classname. so if the autoloader > encounters a unknown classname (=constant), it knows in which file it > finds that class. if it isnt there or has another name, it fails.but when request is processed at the first time all is right: rails loads necessary library (require ''classes_lib'') and returns a correct response. interestingly, why at the second time loading is not working: may be it decided library had been already loaded but constant (class name) is not defined and it tries to load library with default name (based on constant/class name) ?> > 2006/8/15, Vladimir Kurnavenkov <vladimir@psoft.od.ua > <mailto:vladimir@psoft.od.ua>>: > > Vladimir Kurnavenkov wrote: > > > Michael Siebert wrote: > > > >> just put your AR model in /app/models. at least that works for > me (i > >> didn''t try it otherwise, though) > > > > > > I have moved classes_lib.rb to /app/models, modified ''require'' > and got > > the same error message :( > > I have renamed classes_lib.rb -> app/models/account_extended.rb > and now > it is working :) > but it is very strangely.... > > > > >> > >> 2006/8/15, Vladimir Kurnavenkov < vladimir@psoft.od.ua > <mailto:vladimir@psoft.od.ua> > >> <mailto:vladimir@psoft.od.ua <mailto:vladimir@psoft.od.ua>>>: > >> > >> Hello, > >> I got the following issue and I do not know how to resolve it: > >> #1. created parent class (AccountExtended) for some my models > >> (lib/classes_lib.rb): > >> class AccountExtended < ActiveRecord::Base > >> def self.findByAccount > >> end > >> end > >> > >> #2. created model Country: > >> require ''lib/classes_lib'' > >> class Country < AccountExtended > >> end > >> > >> #3. and added a test controller what shows an issue > >> (view_controller.rb): > >> class ViewController < ApplicationController > >> def index > >> @countries = Country.find(:all) > >> end > >> end > >> > >> index.rhtml: > >> <table> > >> <% @countries.each do |c| -%> > >> <tr><td><%= c.full_name %></td></tr> > >> <% end -%> > >> </table> > >> > >> (it is simply a skeleton) > >> > >> then I start webrick, refresh page in my browser and see > countries > >> list. > >> After second refresh a browser''s page I get: > >> ------------------------------------------------------ > >> > >> > >> NameError in ViewController#index > >> > >> uninitialized constant AccountExtended > >> > >> |RAILS_ROOT: script/../config/..| > >> > >> Application Trace <http://localhost:3000/view# > <http://localhost:3000/view#> > >> <http://localhost:3000/view#>> | Framework Trace > >> > >> |This error occured while loading the following files: > >> country.rb > >> account_extended.rb > >> --------------------------------------- > >> | > >> > >> Please, can anybody explain me what I do wrongly ? > >> Thanks. > >> > >> -- > >> Vladimir Kurnavenkov > >> > >> > >> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > <mailto:Rails@lists.rubyonrails.org> > <mailto:Rails@lists.rubyonrails.org > <mailto:Rails@lists.rubyonrails.org>> > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > >> > >> > >> > >> > >> -- > >> Michael Siebert <info@siebert-wd.de <mailto:info@siebert-wd.de> > <mailto:info@siebert-wd.de <mailto:info@siebert-wd.de>>> > >> > >> www.stellar-legends.de <http://www.stellar-legends.de> > <http://www.stellar-legends.de <http://www.stellar-legends.de>> - > >> Weltraum-Browsergame im Alpha-Stadium > >> > >> > ------------------------------------------------------------------------ > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > >> http://lists.rubyonrails.org/mailman/listinfo/rails > <http://lists.rubyonrails.org/mailman/listinfo/rails> > >> > >> > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rails mailing list > > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > -- > Vladimir Kurnavenkov > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > -- > Michael Siebert <info@siebert-wd.de <mailto:info@siebert-wd.de>> > > www.stellar-legends.de <http://www.stellar-legends.de> - > Weltraum-Browsergame im Alpha-Stadium > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Vladimir Kurnavenkov -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5181 bytes Desc: S/MIME Cryptographic Signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060816/902abea6/smime-0001.bin