Hi Francois-
Merb does not do automagick loading of classes via const_missing like
rails does. So if you have STI models, you need to add specific
require statements so thingsa load in the proper order.
You can either explicitely require the modesl in order in your
merb_init.rb or you can require the parent STI class fro the sibling
STI classes to make sure it is loaded first.
Cheers-
-Ezra
On Dec 12, 2007, at 7:25 PM, Fran?ois Beausoleil wrote:
> Hi all,
>
> I''m wondering about my sanity here. There''s probably
something
> simple I
> overlooked. First off, I have close to zero experience with Merb.
>
> 1. I configured use_orm :activerecord in config/dependencies.rb;
> 2. I have a file named app/models/measurement.rb which looks like
> this:
>
> class Measurement < Observation
> end
>
> 3. I have another file named app/models/observation.rb which looks
> like
> this:
>
> class Observation < ActiveRecord::Base
> belongs_to :feature
> belongs_to :node
> belongs_to :observation_type
> end
>
> 4. I ran rake freeze_from_svn
> 5. I start merb using script/merb and stdout/stderr look like this:
>
> $ script/merb
> Merb started with these options:
> ---
> :exception_details: true
> :reloader: true
> :session_secret_key: .6393
> :mongrel_x_sendfile: true
> :reloader_time: 0.5
> :cache_templates: false
> :merb_root: /home/francois/src/florian-opsdb/trunk/amara
> :use_mutex: true
> :host: 127.0.0.1
> :session_id_cookie_only: true
> :environment: development
> :port: "4000"
> :query_string_whitelist: []
>
>
> Started merb_init.rb ...
> Connecting to database...
> Thu, 13 Dec 2007 03:22:38 GMT: loading gem
''merb_activerecord'' from
> config/dependencies.rb:16 ...
> Loading Application...
> ---
> - /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib
> - /home/francois/src/florian-opsdb/trunk/amara/lib
> - projects/mongrel_experimental/lib/
> - /home/francois/src/florian-opsdb/trunk/amara/lib
> - /home/francois/src/florian-opsdb/trunk/amara/app/controllers
> - /home/francois/src/florian-opsdb/trunk/amara/app/models
> - /home/francois/src/florian-opsdb/trunk/amara/framework
> - /usr/lib/ruby/gems/1.8/gems/abstract-1.0.0/bin
> - /usr/lib/ruby/gems/1.8/gems/abstract-1.0.0/lib
> - /usr/lib/ruby/gems/1.8/gems/erubis-2.4.1/bin
> - /usr/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib
> - /usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/bin
> - /usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib
> - /usr/lib/ruby/gems/1.8/gems/cgi_multipart_eof_fix-2.5.0/bin
> - /usr/lib/ruby/gems/1.8/gems/cgi_multipart_eof_fix-2.5.0/lib
> - /usr/lib/ruby/gems/1.8/gems/daemons-1.0.9/bin
> - /usr/lib/ruby/gems/1.8/gems/daemons-1.0.9/lib
> - /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/bin
> - /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/lib
> - /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/ext
> - /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin
> - /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib
> - /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/ext
> - /usr/lib/ruby/gems/1.8/gems/json-1.1.2/bin
> - /usr/lib/ruby/gems/1.8/gems/json-1.1.2/ext/json/ext
> - /usr/lib/ruby/gems/1.8/gems/json-1.1.2/ext
> - /usr/lib/ruby/gems/1.8/gems/json-1.1.2/lib
> - /usr/lib/ruby/gems/1.8/gems/rubyforge-0.4.4/bin
> - /usr/lib/ruby/gems/1.8/gems/rubyforge-0.4.4/lib
> - /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
> - /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
> - /usr/lib/ruby/gems/1.8/gems/hoe-1.3.0/bin
> - /usr/lib/ruby/gems/1.8/gems/hoe-1.3.0/lib
> - /usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/bin
> - /usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib
> - /usr/lib/ruby/gems/1.8/gems/ParseTree-2.0.2/bin
> - /usr/lib/ruby/gems/1.8/gems/ParseTree-2.0.2/lib
> - /usr/lib/ruby/gems/1.8/gems/ParseTree-2.0.2/test
> - /usr/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/bin
> - /usr/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib
> - /usr/lib/ruby/gems/1.8/gems/mime-types-1.15/bin
> - /usr/lib/ruby/gems/1.8/gems/mime-types-1.15/lib
> - /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/bin
> - /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib
> - /usr/lib/ruby/gems/1.8/gems/rubigen-1.1.1/bin
> - /usr/lib/ruby/gems/1.8/gems/rubigen-1.1.1/lib
> - /usr/lib/ruby/gems/1.8/gems/merb-0.4.1/bin
> - /usr/lib/ruby/gems/1.8/gems/merb-0.4.1/lib
> - /usr/lib/ruby/gems/1.8/gems/merb_activerecord-0.4.3/bin
> - /usr/lib/ruby/gems/1.8/gems/merb_activerecord-0.4.3/lib
> - /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.1/bin
> - /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib
> - /usr/lib/ruby/gems/1.8/gems/builder-2.1.2/bin
> - /usr/lib/ruby/gems/1.8/gems/builder-2.1.2/lib
> - /usr/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/bin
> - /usr/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib
> - /usr/local/lib/site_ruby/1.8
> - /usr/local/lib/site_ruby/1.8/i486-linux
> - /usr/local/lib/site_ruby/1.8/i386-linux
> - /usr/local/lib/site_ruby
> - /usr/lib/ruby/1.8
> - /usr/lib/ruby/1.8/i486-linux
> - /usr/lib/ruby/1.8/i386-linux
> - .
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:266:in
> `load_missing_constant'': uninitialized constant Observation
> (NameError)
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:453:in
> `const_missing''
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:465:in
> `const_missing''
> from
> /home/francois/src/florian-opsdb/trunk/amara/app/models/
> measurement.rb:1
> from
> /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
> from
> /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:496:in
> `require''
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:342:in
> `new_constants_in''
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/
> dependencies.rb:496:in
> `require''
> ... 8 levels...
> from
> /home/francois/src/florian-opsdb/trunk/amara/framework/merb/
> server.rb:262:in
> `initialize_merb''
> from
> /home/francois/src/florian-opsdb/trunk/amara/framework/merb/
> server.rb:606:in
> `mongrel_start''
> from
> /home/francois/src/florian-opsdb/trunk/amara/framework/merb/
> server.rb:542:in
> `run''
> from script/merb:3
>
> The YAML document there is the result of $stderr.puts $:.to_yaml,
> which
> I put in right before the call to Merb::Server.load_application in
> config/merb_init.rb.
>
> Anybody can see what I did wrong ?
>
> Thanks !
> Fran?ois
> _______________________________________________
> Merb-devel mailing list
> Merb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/merb-devel
- Ezra Zygmuntowicz
-- Founder & Software Architect
-- ezra at engineyard.com
-- EngineYard.com