ncuesta / dropzonejs-rails

Spice your Rails apps with some Dropzone sugar!
http://rubygems.org/gems/dropzonejs-rails
MIT License
311 stars 56 forks source link

Rails 4 compatibility #14

Closed senny closed 10 years ago

senny commented 10 years ago

I have a question related to compatibility with Rails 4.0. When I deploy my application the images won't load correctly. Looking at the directory structure I see that the images are kept in vendor/assets. The following paragraph is straight from the Rails upgrading guide (3.2 -> 4.0):

In Rails 4.0, precompiling assets no longer automatically copies non-JS/CSS assets from vendor/assets and lib/assets. Rails application and engine developers should put these assets in app/assets or configure config.assets.precompile.

Taken from the Action Pack section in the guide.

Edit: Of course adding it to the precompile array as described in the guides does fix the issue:

Rails.application.config.assets.precompile += %w( dropzone/spritemap.png )

It would still be nice to have it work out of the box. Or at least mention it in the README.

ncuesta commented 10 years ago

You could also add this line so that any changes in the images won't affect your setup:

# In your config/application.rb or an initializer:
config.assets.paths << Rails.root.join('vendor', 'assets', 'images')

I'll see which is the better approach for this and reference this ticket.

Thanks!

senny commented 10 years ago

@ncuesta If you'd put your assets in app/ instead of vendor/ it should work out of the box.

senny commented 10 years ago

:heart:

ncuesta commented 10 years ago

@senny I tested the fix on a vanilla Rails 4.1.4 app, please let me know if you still have any issues.

Thanks for pointing this out! You made it into the README :laughing:

senny commented 10 years ago

@ncuesta are you going to release to rubygems or you'd like me to test it beforehand?

ncuesta commented 10 years ago

Here you go: http://rubygems.org/gems/dropzonejs-rails

senny commented 10 years ago

The released version of the gem does not contain the assets. You'll have to adjust the gemspec to include them.

ncuesta commented 10 years ago

Oops.. sorry about that. Should be fixed now

senny commented 10 years ago

thank man. It's working now. I suggest you yank version 0.5.0 to prevent someone from accidentally using it.

ncuesta commented 10 years ago

Just did so, thanks for the link -- I was going to google that later on otherwise :+1: