SQLite3::SQLException: no such column: organizations.user_id: SELECT "organizations".* FROM "organizations" WHERE "organizations"."user_id" = 2
沒有這樣的列有belongs_to的CLASS_NAME關係
我已經安裝我的模型是這樣的:
用戶:
User has_many :organizations
組織:
attr_accessible :name, :founder, :founder_id
belongs_to :founder, :class_name => 'User'
架構:
create_table "organizations", :force => true do |t|
t.string "name"
t.integer "founder_id"
當我去編輯在軌管理員用戶,我得到這個消息:
`SQLite3::SQLException: no such column: organizations.user_id: SELECT "organizations".* FROM "organizations" WHERE "organizations"."user_id" = 2`
我想在組織,其中方正是用戶訪問方正。 它看起來像rails_admin
尋找user_id時它應該尋找一個方正。
上問: Can access _id of a references object but not the object directly