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

undefined method `authenticate_user!' for # #57

Closed artisr closed 11 years ago

artisr commented 11 years ago

Hi.. I get a following error when i try to upload images using redactor rails:

NoMethodError in RedactorRails::PicturesController#index

undefined method `authenticate_user!' for # RedactorRails::PicturesController:0x000000050028f0>

here's the full trace: https://gist.github.com/ArtisR/ab5628972051a0a846cb

artisr commented 11 years ago

For some reason there was an user_id field in database.. (in redactor assets table).. dropped the column.. and everything works as expected..

jerefrer commented 11 years ago

I just ran into the same issue.

The thing is I assumed that if I didn't pass the --devise option to the generator it wouldn't add the user_id column to the refinery_assets table.

But then I checked the code and realized even the simple generator adds the user_id column. So I had to create my own migration to remove that column.

Is that on purpose or have you just forgotten to remove it from the simple migration ? If it's on purpose you should update the README to explain it more clearly.

Cheers !

eric-norcross commented 11 years ago

I removed the user_id field from the redactor_assets table but I'm still getting this error when I try to upload an image.

Started GET "/redactor_rails/pictures" for 127.0.0.1 at 2013-06-21 10:20:27 -0700
Processing by RedactorRails::PicturesController#index as JSON
Completed 500 Internal Server Error in 2ms

NoMethodError (undefined method `authenticate_user!' for #<RedactorRails::PicturesController:0x007ff91174a240>):
  redactor-rails (0.3.5) lib/redactor-rails/devise.rb:4:in `redactor_authenticate_user!'
Arcolye commented 11 years ago

Thank you, thank you, thank you, and thank you

staycreativedesign commented 10 years ago

Getting the same thing as eric-norcross

staycreativedesign commented 10 years ago

Processing by RedactorRails::PicturesController#index as JSON Completed 500 Internal Server Error in 1ms

NoMethodError (undefined method authenticate_user!' for #<RedactorRails::PicturesController:0x007f3368ceb128>): redactor-rails (0.4) lib/redactor-rails/devise.rb:4:inredactor_authenticate_user!'

eric-norcross commented 10 years ago

@staycreativedesign - I never figured it out and decided to go with a different solution instead. Good luck!

staycreativedesign commented 10 years ago

Im assuming you went with CKEditor??

On Thu, Sep 26, 2013 at 1:34 PM, Eric Norcross notifications@github.comwrote:

@staycreativedesign https://github.com/staycreativedesign - I never figured it out and decided to go with a different solution instead. Good luck!

— Reply to this email directly or view it on GitHubhttps://github.com/SammyLin/redactor-rails/issues/57#issuecomment-25187224 .

eric-norcross commented 10 years ago

Yep. Though, that was not without it's own set of challenges.

On Sep 26, 2013, at 10:38 AM, staycreativedesign notifications@github.com wrote:

Im assuming you went with CKEditor??

On Thu, Sep 26, 2013 at 1:34 PM, Eric Norcross notifications@github.comwrote:

@staycreativedesign https://github.com/staycreativedesign - I never figured it out and decided to go with a different solution instead. Good luck!

— Reply to this email directly or view it on GitHubhttps://github.com/SammyLin/redactor-rails/issues/57#issuecomment-25187224 .

— Reply to this email directly or view it on GitHub.

Arcolye commented 10 years ago

The only way I got it to work without authentication was to go back to an older version

gem 'redactor-rails', '0.3.3'

Then just taking out the user_id column should work, as it does for me & ArtisR & jerefrer.

Arcolye commented 10 years ago

This might help https://github.com/SammyLin/redactor-rails/issues/85

amitfriedman12 commented 8 years ago

I added this line to my controller which did the trick for me:

    include Devise::Controllers::Helpers