Ah, okay, thanks Pat, that sounds like a workaround! Will try it out.

The weird thing is that the db requirements are only there when using
the observers. I don't understand why...

Nico



On 7 Nov., 19:16, Pat Allan <[email protected]> wrote:
> Sorry Nico, nothing yet… it's hard to avoid the db requirements.
>
> Maybe you can only set observers if ENV['RAILS_GROUPS'] isn't set to assets?
>
> --
> Pat
>
> On 07/11/2011, at 4:25 PM, nico wrote:
>
>
>
>
>
>
>
> > Anyone any ideas here?
>
> > On 5 Nov., 16:28, nico <[email protected]> wrote:
> >> Sure:
>
> >> config.active_record.observers = [:company_cache_observer,
> >>                                      :layout_cache_observer,
> >>                                        :user_observer,
> >>                                  :userpoints_observer,
> >>                                  :ownership_observer]
> >> On 5 Nov., 16:13, Pat Allan <[email protected]> wrote:
>
> >>> Hi Nico
>
> >>> Can you show us how you're loading the observers in your application.rb 
> >>> file?
>
> >>> --
> >>> Pat
>
> >>> On 05/11/2011, at 4:02 PM, nico wrote:
>
> >>>> Strangely, thinking sphinx's model loading in define_index triggers a
> >>>> database connection to be established when the model with define_index
> >>>> is observed by an observer.
>
> >>>> This causes rake tasks like assets:precompile to depend on a db
> >>>> connection which should normally not be required. This dependency
> >>>> makes asset compilation on Heroku fail. If I remove the observer
> >>>> loading in application.rb, the database dependency does't exist and
> >>>> rake tasks work fine without a db configured.
>
> >>>> It's quite hard to debug this, help is greatly appreciated! Here is
> >>>> the stack trace for rake assets:precompile when rails is configured
> >>>> with a non existing database and using observers:
>
> >>>> bundle exec rake assets:precompile RAILS_ENV=staging --trace
> >>>> ** Invoke assets:precompile (first_time)
> >>>> ** Execute assets:precompile
> >>>> /Users/nico/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/nico/.rvm/gems/
> >>>> ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=staging
> >>>> RAILS_GROUPS=assets --trace
> >>>> ** Invoke assets:precompile:all (first_time)
> >>>> ** Execute assets:precompile:all
> >>>> ** Invoke assets:precompile:primary (first_time)
> >>>> ** Invoke assets:environment (first_time)
> >>>> ** Execute assets:environment
> >>>> ** Invoke environment (first_time)
> >>>> ** Execute environment
> >>>> rake aborted!
> >>>> FATAL:  database "non_existing_database" does not exist
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:1032:in
> >>>> `initialize'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:1032:in `new'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:1032:in
> >>>> `connect'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:301:in
> >>>> `initialize'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/postgresql_adapter.rb:28:in
> >>>> `postgresql_connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:304:in
> >>>> `new_connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:323:in
> >>>> `checkout_new_connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:265:in
> >>>> `block (2 levels) in checkout'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:261:in
> >>>> `loop'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:261:in
> >>>> `block in checkout'
> >>>> /Users/nico/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:
> >>>> 201:in `mon_synchronize'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:260:in
> >>>> `checkout'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:162:in
> >>>> `connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_pool.rb:409:in
> >>>> `retrieve_connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_specification.rb:
> >>>> 107:in `retrieve_connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/connection_adapters/abstract/connection_specification.rb:
> >>>> 89:in `connection'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/base.rb:1473:in `replace_bind_variables'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/base.rb:1460:in `sanitize_sql_array'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/base.rb:1366:in `sanitize_sql_for_conditions'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/relation/query_methods.rb:259:in `build_where'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/relation/query_methods.rb:124:in `where'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/
> >>>> active_record/base.rb:444:in `where'
> >>>> /Users/nico/Rails/myapp/app/models/user.rb:194:in `<class:User>'
> >>>> /Users/nico/Rails/myapp/app/models/user.rb:100:in `<top (required)>'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `block in require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:225:in `load_dependency'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:348:in `require_or_load'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:489:in `load_missing_constant'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:181:in `block in const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `each'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/aws-s3-0.6.2/lib/aws/s3/
> >>>> extensions.rb:206:in `const_missing_from_s3_library'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:501:in `load_missing_constant'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:181:in `block in const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `each'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/aws-s3-0.6.2/lib/aws/s3/
> >>>> extensions.rb:206:in `const_missing_from_s3_library'
> >>>> /Users/nico/Rails/myapp/app/models/company.rb:103:in `<class:Company>'
> >>>> /Users/nico/Rails/myapp/app/models/company.rb:45:in `<top (required)>'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `block in require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:225:in `load_dependency'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:240:in `require'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:348:in `require_or_load'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:489:in `load_missing_constant'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:181:in `block in const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `each'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/aws-s3-0.6.2/lib/aws/s3/
> >>>> extensions.rb:206:in `const_missing_from_s3_library'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:501:in `load_missing_constant'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:181:in `block in const_missing'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `each'
> >>>> /Users/nico/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/
> >>>> active_support/dependencies.rb:179:in `const_missing'
>
> ...
>
> Erfahren Sie mehr »

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to