redactor-rails
redactor-rails copied to clipboard
NameError (uninitialized constant RedactorRails::Asset::User)
I am trying to use Redactor with devise but I get this error when I want to upload an image. The name of my users model is Member. So I followed the instructions, and changed the user_id field to member_id.
But still getting the error below:
Started POST "/redactor_rails/pictures?authenticity_token=62nv7KKJET5NpaoPmm3rs%2BiYds3qPMgfTJDP2L8hF10%3D" for 127.0.0.1 at 2013-08-03 18:28:43 +0200 Processing by RedactorRails::PicturesController#create as HTML Parameters: {"file"=>#<ActionDispatch::Http::UploadedFile:0x007ff1c5d5bab0 @original_filename="100_2995.JPG", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name="file"; filename="100_2995.JPG"\r\nContent-Type: image/jpeg\r\n", @tempfile=#Tempfile:/var/folders/90/wjyhxjfs3gz3xkhsk8z_sz2w0000gn/T/RackMultipart20130803-4405-1cl023b>, "authenticity_token"=>"62nv7KKJET5NpaoPmm3rs+iYds3qPMgfTJDP2L8hF10="} Member Load (0.3ms) SELECT "members".* FROM "members" WHERE "members"."id" = 10 LIMIT 1 Completed 500 Internal Server Error in 2442ms
NameError (uninitialized constant RedactorRails::Asset::User):
activerecord (3.2.13) lib/active_record/inheritance.rb:111:in compute_type' activerecord (3.2.13) lib/active_record/reflection.rb:172:in
klass'
activerecord (3.2.13) lib/active_record/associations/association.rb:202:in raise_on_type_mismatch' activerecord (3.2.13) lib/active_record/associations/belongs_to_association.rb:6:in
replace'
activerecord (3.2.13) lib/active_record/associations/singular_association.rb:17:in writer' activerecord (3.2.13) lib/active_record/associations/builder/association.rb:51:in
block in define_writers'
/usr/local/rvm/gems/ruby-2.0.0-p0/bundler/gems/redactor-rails-d0c1fc21420e/app/controller/redactor_rails/pictures_controller.rb:16:in create' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in
send_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:167:in process_action' actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in
process_action'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in block in process_action' activesupport (3.2.13) lib/active_support/callbacks.rb:425:in
_run__512611831908309020__process_action__292749284689078618__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.13) lib/active_support/callbacks.rb:385:in
_run_process_action_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:in
process_action'
actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in
block in process_action'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in block in instrument' activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in
instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in instrument' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in
process_action'
actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in process_action' activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in
process_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:121:in process' actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in
process'
actionpack (3.2.13) lib/action_controller/metal.rb:203:in dispatch' actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in
dispatch'
actionpack (3.2.13) lib/action_controller/metal.rb:246:in block in action' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in
call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in dispatch' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in
call'
journey (1.0.4) lib/journey/router.rb:68:in block in call' journey (1.0.4) lib/journey/router.rb:56:in
each'
journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in
call'
railties (3.2.13) lib/rails/engine.rb:479:in call' railties (3.2.13) lib/rails/railtie/configurable.rb:30:in
method_missing'
journey (1.0.4) lib/journey/router.rb:68:in block in call' journey (1.0.4) lib/journey/router.rb:56:in
each'
journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in
call'
warden (1.2.3) lib/warden/manager.rb:35:in block in call' warden (1.2.3) lib/warden/manager.rb:34:in
catch'
warden (1.2.3) lib/warden/manager.rb:34:in call' actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in
call'
rack (1.4.5) lib/rack/etag.rb:23:in call' rack (1.4.5) lib/rack/conditionalget.rb:35:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in call' rack (1.4.5) lib/rack/session/abstract/id.rb:210:in
context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in call' actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in
call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in call' activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in block in call' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in
_run__1647929714818531281__call__880499119694952234__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.13) lib/active_support/callbacks.rb:385:in
_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in call' actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in
call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in call_app' railties (3.2.13) lib/rails/rack/logger.rb:16:in
block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in tagged' railties (3.2.13) lib/rails/rack/logger.rb:16:in
call'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in call' rack (1.4.5) lib/rack/methodoverride.rb:21:in
call'
rack (1.4.5) lib/rack/runtime.rb:17:in call' activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in
call'
rack (1.4.5) lib/rack/lock.rb:15:in call' actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in
call'
railties (3.2.13) lib/rails/engine.rb:479:in call' railties (3.2.13) lib/rails/application.rb:223:in
call'
rack (1.4.5) lib/rack/content_length.rb:14:in call' railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in
call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in service' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in
service'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in run' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:in
block in start_thread'
Rendered /usr/local/rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.1ms) Rendered /usr/local/rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms) Rendered /usr/local/rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (12.9ms)
You overrides user class and controller methods ? http://i.imgur.com/pgd84Ij.png
Hi Alex!
Yes.
This is in my application controller: def redactor_authenticate_user! authenticate_member! # devise before_filter end
def redactor_current_user current_member # devise user helper end
This is my redactor.rb in rails config folder: module RedactorRails def self.devise_user %s(member) # name of your user class end
You may override this to support legacy schema.
def self.devise_user_key
"#{self.devise_user.to_s}_id".to_sym
end
end