Rails - 无法访问ckeditor_assets使用Ckeditor Gem&回形针

时间:2014-07-28 07:02:21

标签: ruby-on-rails activerecord ckeditor paperclip

我正在尝试从此表中转储数据以查看内容:

create_table "ckeditor_assets", force: true do |t|
   t.string   "data_file_name",               null: false
   t.string   "data_content_type"
   t.integer  "data_file_size"
   t.integer  "assetable_id"
   t.string   "assetable_type",    limit: 30
   t.string   "type",              limit: 30
   t.integer  "width"
   t.integer  "height"
   t.datetime "created_at"
   t.datetime "updated_at"
end

通常我会这样做:

 CkeditorAsset.all

但我明白了:

NameError: uninitialized constant CkeditorAsset

我很确定表中有数据,因为我已经成功使用了Ckeditor& amp;回形针将照片上传到我的s3水桶。

如果我跑:

ActiveRecord::Base.connection.tables

......表名显得很好。

我在这里做错了什么?

为什么这与我在RoR的有限经验中遇到的其他简单的“全部”ActiveRecord调用不同?

1 个答案:

答案 0 :(得分:1)

gem ckeditor在名称空间Ckeditor中创建模型,以便使用所有资源:

Ckeditor::Asset.all

和类似的:

Ckeditor::Picture.all
Ckditor::AttachmentFile.all