cloudinary / cloudinary_gem

Cloudinary GEM for Ruby on Rails integration
https://cloudinary.com
419 stars 284 forks source link

Rails 5 Deprecation warning - alias_method_chain #211

Closed giugrilli closed 7 years ago

giugrilli commented 8 years ago

After upgrading to Rails 5 I am receiving the following deprecation warning:

DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in included at /usr/lib/ruby/gems/2.3.0/gems/cloudinary-1.2.2/lib/cloudinary/helper.rb:273)

roeeba commented 8 years ago

Cloudinary currently doesn’t support Rails 5. The warning you get is a deprecation warning - for now it doesn’t require any change in code - yours or Cloudinary's. Stay tuned for our future releases and our Rails 5 support.

holoiii commented 8 years ago

@roeeba Is rails 5 supported now? I seem to be able to use the backend upload + carrierwave integration just fine, but the direct upload via the jquery plugin isn't working. I followed the instructions in your documentation but when a file is selected, nothing happens.

taragano commented 8 years ago

Hi @holoiii,

The client-side (jQuery) uploads seems to be working successfully when I tried it here on my Rails 5 app.

Please make sure that:

  1. You've included Cloudinary's necessary JS files in your app, e.g., including //= require cloudinary in your Asset Pipeline.
  2. You've configured your Cloudinary account in the form page, e.g., include <%= cloudinary_js_config %> on that page.
  3. You've initialized the input field, e.g., by including the following in the form page as well:

    <script type="text/javascript">
    $('.cloudinary-fileupload').cloudinary_fileupload();
    </script>

Let me know if this works for you?

holoiii commented 8 years ago

Ahh I see.

$('.cloudinary-fileupload').cloudinary_fileupload();

That did the trick. None of your documentation mentioned that, however.

For example:

  1. http://cloudinary.com/blog/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery
  2. http://cloudinary.com/documentation/rails_image_upload#direct_uploading_from_the_browser
taragano commented 8 years ago

Thank you for the update. I'm glad it's working for you now :) Also, thank you for your feedback. We'll make sure to make this clearer in our docs. Anything else I can help you with?

VanPaitin commented 8 years ago

Is this issue resolved, if it is, then I would suggest closing it. Should it be closed?

parterburn commented 8 years ago

@andela-mpitan the deprecation warning still exists, so I'd recommend leaving the issue open until that's resolved.

taragano commented 8 years ago

While there's no ETA for this yet, it's on our road map to officially support Rails 5.

murdoch commented 7 years ago

The error message is now a full on show stopper after upgrading to rails 5.1.beta1:

$ bin/rails s
=> Booting Puma
=> Rails 5.1.0.beta1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/home/stephen/.rvm/gems/ruby-2.4.0@rails5/gems/cloudinary-1.5.2/lib/cloudinary/helper.rb:272:in `block in included': undefined method `alias_method_chain' for ActionView::Base:Class (NoMethodError)
Did you mean?  alias_method
    from /home/stephen/.rvm/gems/ruby-2.4.0@rails5/gems/cloudinary-1.5.2/lib/cloudinary/helper.rb:267:in `class_eval'
    from /home/stephen/.rvm/gems/ruby-2.4.0@rails5/gems/cloudinary-1.5.2/lib/cloudinary/helper.rb:267:in `included'
    from /home/stephen/.rvm/gems/ruby-2.4.0@rails5/gems/cloudinary-1.5.2/lib/cloudinary/railtie.rb:6:in `include'
    from /home/stephen/.rvm/gems/ruby-2.4.0@rails5/gems/cloudinary-1.5.2/lib/cloudinary/railtie.rb:6:in `block in <class:Railtie>'

Any ideas? Removing the cloudinary gem 'resolves' the problem.

hjoseph96 commented 7 years ago

I concur with the above, really want to get on with the upgrade.

oystersauce8 commented 7 years ago

It's a show stopper indeed. Temporary workaround:

diff --git a/03_www.boingboing.com/config/cloudinary.yml b/03_www.boingboing.com/config/cloudinary.yml
index 5b5c31f..1c8a104 100644
--- a/03_www.boingboing.com/config/cloudinary.yml
+++ b/03_www.boingboing.com/config/cloudinary.yml
@@ -3,17 +3,17 @@ development:
   cloud_name: dufdsudg8
   api_key: '145433454379125'
   api_secret: JaC96lb5345345345347PqbQ
-  enhance_image_tag: true
+  enhance_image_tag: false
   static_image_support: false
 production:
   cloud_name: duv534534udg8
   api_key: '143653453453453479125'
   api_secret: JaC96l543534534534MkRS7PqbQ
-  enhance_image_tag: true
+  enhance_image_tag: false
   static_image_support: true
 test:
   cloud_name: duv534534538
   api_key: '145343451279125'
   api_secret: JaC96lb0C534534534pDMkRS7PqbQ
-  enhance_image_tag: true
+  enhance_image_tag: false
   static_image_support: false
tdegrunt commented 7 years ago

@oystersauce8 Hope those aren't your production credentials.

sbleon commented 7 years ago

Rails 5.0.0 was released June 30, 2016. It's a little bit crazy that this commercially-supported gem doesn't support it yet.

@roeeba, @taragano can you please give us an update on this?

dwightwatson commented 7 years ago

Totally agree.

Someone has even been kind enough to fix the relevant issue for Rails 5.1.0 (see #243). Can we (at the very least) get that one merged in?

axhamre commented 7 years ago

Has anyone come up with a temporary hack meanwhile?

havenwood commented 7 years ago

This is resolved on master with the merge of 3f996f7 from #243.

taragano commented 7 years ago

It would be great if you guys could please let us know if it's working for you now. Thanks

sbleon commented 7 years ago

@taragano I can't test this change until there is a release because when I install cloudinary from Github, I get a Sprockets::FileNotFound error in my app: couldn't find file 'cloudinary' with type 'application/javascript'.

I think this oddness is due to some sort of packaging that is mentioned in the README:

During the installation or update of the Cloudinary GEM, the latest Cloudinary JavaScript library is automatically fetched and bundled with the GEM.

kevinelliott commented 7 years ago

Any progress on this?

havenwood commented 7 years ago

@kevinelliott This issue is fixed in version 1.7.0, which has #243 merged.

idobarnoam commented 7 years ago

Closing this since the issue was fixed as stated above.