Rails 4 relationship issues, On login

為{幸葍}努か 提交于 2019-12-23 04:56:25

问题


I'm not sure what has changed getting this error when trying to login:

ERROR:  relation "tags" does not exist
LINE 1: SELECT DISTINCT "tags".* FROM "tags" INNER JOIN "taggings" O...

The tag model:

class Tag < ActiveRecord::Base
  attr_accessor :unread_count, :user_feeds

  has_many :taggings
  has_many :feeds, through: :taggings
end

The tagging model:

class Tagging < ActiveRecord::Base
  belongs_to :tag
  belongs_to :feed
  belongs_to :user
end

And the user relationships:

class User < ActiveRecord::Base
  has_one :coupon
  has_many :subscriptions, dependent: :delete_all
  has_many :feeds, through: :subscriptions
  has_many :entries, through: :feeds
  has_many :imports, dependent: :destroy
  has_many :billing_events, as: :billable, dependent: :delete_all
  has_many :taggings, dependent: :delete_all
  has_many :tags, through: :taggings
  has_many :sharing_services, dependent: :delete_all
  has_many :unread_entries, dependent: :delete_all
  has_many :starred_entries, dependent: :delete_all
  has_many :saved_searches, dependent: :delete_all
  has_many :actions, dependent: :destroy
  belongs_to :plan
end

This error is new and came right after I tried to install the intercom.io gem. I removed the gem, did a gem cleanup, reset the db and still the same error.

Not sure what happened, if anyone has any suggestions I would appreciate it.


回答1:


Checked missing tables, and that was the problem.



来源:https://stackoverflow.com/questions/20445353/rails-4-relationship-issues-on-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!