SammyLin / redactor-rails

This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails
MIT License
389 stars 253 forks source link

uninitialized constant RedactorRails::Asset::User #63

Open connor-t opened 11 years ago

connor-t commented 11 years ago

My devise model name is admin not user and it's giving me some problems with redactor, when trying to upload an image I get the errors below;

I have followed the instructions in the 'defining a devise user model' section, but still get the error

Started POST "/redactor_rails/pictures?authenticity_token=931GXG0D%2BgtwV38IVrDTsMPX8jWh1qSOUk0bVBpWTr4%3D" for 127.0.0.1 at 2013-06-12 13:52:42 +0100 Processing by RedactorRails::PicturesController#create as HTML Parameters: {"file"=>#<ActionDispatch::Http::UploadedFile:0x007f8b0c90eab8 @content_type="image/jpeg", @tempfile=#<File:/var/folders/r3/1gzzfk2964b4tvvndtnr527m0000gn/T/RackMultipart20130612-25128-uvje7>, @original_filename="14.jpg", @headers="Content-Disposition: form-data; name=\"file\"; filename=\"14.jpg\"\r\nContent-Type: image/jpeg\r\n">, "authenticity_token"=>"931GXG0D+gtwV38IVrDTsMPX8jWh1qSOUk0bVBpWTr4="} Admin Load (0.2ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 LIMIT 1 Completed 500 Internal Server Error in 879ms

NameError - uninitialized constant RedactorRails::Asset::User:

ActiveRecord::StatementInvalid at /pictures

SQLite3::SQLException: no such column: redactor_assets.user_id: SELECT "redactor_assets".* FROM "redactor_assets" WHERE "redactor_assets"."type" IN ('RedactorRails::Picture') AND "redactor_assets"."user_id" = 1

(gem) sqlite3-1.3.7/lib/sqlite3/database.rb, line 91

NameError at /pictures

uninitialized constant RedactorRails::Asset::User

(gem) activerecord-3.2.13/lib/active_record/inheritance.rb, line 111

  106                 # We don't want to swallow NoMethodError < NameError errors
  107                 raise e unless e.instance_of?(NameError)
  108               end
  109             end
  110   
> 111             raise NameError, "uninitialized constant #{candidates.first}"
  112           end
  113         end
  114   
  115         private
  116   

App backtrace

Full backtrace