Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::TemplateError: Mysql::Error in production environment #6

Open
ian opened this issue Jul 30, 2009 · 1 comment
Open

ActionView::TemplateError: Mysql::Error in production environment #6

ian opened this issue Jul 30, 2009 · 1 comment

Comments

@ian
Copy link

ian commented Jul 30, 2009

We're getting an interesting situation where a specific series of relationships produces an unknown column error in production only.

Consider the following:
class User < ActiveRecord::Base
has_many_polymorphs :accessible_products, :through => :accessibles, :as => :contact,
:foreign_key => 'contact_id', :foreign_type_key => 'contact_type',
:polymorphic_key => 'owner_id', :polymorphic_type_key => 'owner_type',
:from => [:"product/one",:"product/two"]
end

                 class Product < ActiveRecord::Base
                 has_many_polymorphs :accessors, :through => :accessibles, :as => :owner, 
                  :foreign_key => 'owner_id', :foreign_type_key => 'owner_type',
                  :polymorphic_key => 'contact_id', :polymorphic_type_key => 'contact_type',
                  :from => [:emails, :users]
                  end

                  class Accessible < ActiveRecord::Base
                  acts_as_double_polymorphic_join :owners =>[:"product/one",:"product/two"],
                              :contacts => [:users, :emails]
                  end

This cyclical relationship should be handled by the acts_as_double_polymorphic_join but it's erroring in production, possibly due preloading of models and caching them, not sure.

The error we receive in production is ActionView::TemplateError: Mysql::Error: Unknown column 'accessibles.accessible_product_id'

The foreign and polymorphic keys are clearly defined, not sure why this is happening and only in production.

@ghost
Copy link

ghost commented Aug 5, 2009

best bet is to make a failing test and fix it yourself; this project is in patch-accepting-mode only :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant