Macrow / rails_kindeditor

Kindeditor for Ruby on Rails
260 stars 108 forks source link

Upload Image Error #59

Closed Verkalets closed 10 years ago

Verkalets commented 10 years ago

After uploading i have this alert undefined method `asset_changed?' for #Kindeditor::Image:0x007fc2fda4d608

Macrow commented 10 years ago

Show your log please, I need some details.

Verkalets commented 10 years ago

This is log from terminal

Started POST "/kindeditor/upload?dir=image" for 127.0.0.1 at 2014-01-29 10:09:38 +0200 Processing by Kindeditor::AssetsController#create as HTML Parameters: {"localUrl"=>"C:\fakepath\photo.jpg", "imgFile"=>#<ActionDispatch::Http::UploadedFile:0x007fcd5f366f30 @tempfile=#<File:/var/folders/j4/h9v6b9mn0p11gqnx6bsqt9tr0000gn/T/RackMultipart20140129-318-1n09mdt>, @original_filename="photo.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"imgFile\"; filename=\"photo.jpg\"\r\nContent-Type: image/jpeg\r\n">, "dir"=>"image"} Overwriting existing field asset_filename in class Kindeditor::File. Overwriting existing field asset_filename in class Kindeditor::Flash. Overwriting existing field asset_filename in class Kindeditor::Image. Overwriting existing field asset_filename in class Kindeditor::Media. ========= Warning: the owner_id is 0, "delete uploaded files automatically" will not work. ========= Rendered text template (0.0ms) Completed 200 OK in 71ms (Views: 2.7ms)

after i choose file, i see javascript file:

"undefined method `asset_changed?' for #Kindeditor::Image:0x007fcd5b485d48"

Verkalets commented 10 years ago

i use carrierwave-mongoid

Verkalets commented 10 years ago

in my mind, i have problem with owner_id, this is string from ,my form. = f.kindeditor :en_title, id: 'editor_id', :owner_id => @post.id

Also, i use namespace, that i have in top of document = form_for [:dashboard, @post] do |f|

Maybe here some problem?

Macrow commented 10 years ago

If you're using rails4, please specify these gems in your Gemfile

gem 'carrierwave-mongoid', github: 'carrierwaveuploader/carrierwave-mongoid', branch: 'master'
gem "mongoid-grid_fs", github: "ahoward/mongoid-grid_fs", branch: "master"
gem "mongoid", github: "mongoid/mongoid", branch: "master"

if don't, the carrierwave-mongoid will lock to v0.1.0 which could cause the errors you have met. I have tried, if the version was right, there's no errors when uploading.

btw, owner_id doesn't support mongoid.

Verkalets commented 10 years ago

yeah, i used all of this gems. Thanks for help, but i choose other editor