Hello

I have a very small sequel model like this : 

# lib/aws_stats/unique_shop_application_downloads.rb
Sequel::Model.db = StatsDb.connection

class AwsStats::UniqueShopApplicationDownloads < Sequel::Model(:
unique_shop_application_downloads)
  def self.by_shop_application_id(shop_application_id)
    where(shop_application_id: mobile_application_id).get(:user_count)
  end
end

It is call by a AR model

class ShopApplication < ActiveRecord::Base

  class StatsProxy
    attr_reader :sa, :unique_downloads

    def self.proxify_with_stats(shop_applications)
      # ...
      downloads = AwsStats::UniqueShopApplicationDownloads
                  .where(shop_application_id: mas.map(&:id))
                  .to_hash(:shop_application_id, :user_count)
      # ...
    end
  end
end

But sometimes after booting I get :

Circular dependency detected while autoloading constant AwsStats::
UniqueShopApplicationDownloads

I read many blog post and doc :
http://neethack.com/2015/04/rails-circular-de
http://guides.rubyonrails.org/autoloading_and_reloading_constants.html
https://robots.thoughtbot.com/how-to-fix-circular-dependency-errors-in-rails-integration-tests

but still don't understand why I have this issue.

I'm also unable to reproduce the bug locally. Can Sequel be related to this 
issue (I don't think so but I'm stuck)? 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to