kayatela
kayatela

Reputation: 404

Rails - Cannot access ckeditor_assets Table data using Ckeditor Gem & Paperclip

I'm trying to dump the data from this table to see the contents:

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

Normally I would just do this:

 CkeditorAsset.all

but I get:

NameError: uninitialized constant CkeditorAsset

I'm pretty sure there is data in the table, as I have successfully used Ckeditor & Paperclip to upload pictures to my s3 bucket.

And if I run:

ActiveRecord::Base.connection.tables

... the table name appears just fine.

What am I doing wrong here?

Why is this different from other simple "all" ActiveRecord calls I have encountered in my limited experience with RoR?

Upvotes: 0

Views: 301

Answers (1)

Martin M
Martin M

Reputation: 8638

The gem ckeditor creates its models in a namespace Ckeditor, so to get all assets use:

Ckeditor::Asset.all

and similar:

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

Upvotes: 1

Related Questions