SQLite3::SQLException: no such column: organizations.user_id: SELECT "organizations".* FROM "organizations" WHERE "organizations"."user_id" = 2
モデルを次のようにセットアップしました。
ユーザー:
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"
rails-admin でユーザーを編集しようとすると、次のメッセージが表示されます。
`SQLite3::SQLException: no such column: organizations.user_id: SELECT "organizations".* FROM "organizations" WHERE "organizations"."user_id" = 2`
ファウンダーがユーザーである組織のファウンダーにアクセスしたい。rails_admin
ファウンダーを探す必要があるときに、user_id を探すように見えます。
Previous q: 参照オブジェクトの _id にアクセスできますが、オブジェクトに直接アクセスすることはできません