nathancolgate / s3-swf-upload-plugin

A rails 3 gem which allow user upload files to S3 through an embedded flash directly. All UI has been moved out of flex and can be controlled by CSS and JavaScript callbacks.
http://www.nathancolgate.com
MIT License
318 stars 74 forks source link

Heroku ActionView::Template::Error (s3_upload.js isn't precompiled) #52

Closed jeremywhittington closed 12 years ago

jeremywhittington commented 12 years ago

I am currently trying to use this plugin on a Heroku Rails 3.1.3 application.

I have this in my gemfile.

gem 's3_swf_upload', :git => 'git://github.com/nathancolgate/s3-swf-upload-plugin' gem 'aws-s3', :require => 'aws/s3'

I bundled the gem into my application, generated the rails code, created a new controller and view, and added the following to the view.

<%=raw s3_swf_upload_tag %>
<input type="submit" value="Start Uploading" onclick="s3_swf_1_object.startUploading();" />

I have added, committed and pushed all files to the heroku master. I am getting the following error.

2011-12-27T17:53:14+00:00 app[web.1]: Completed 500 Internal Server Error in 129ms 2011-12-27T17:53:14+00:00 app[web.1]: 2011-12-27T17:53:14+00:00 app[web.1]: ActionView::Template::Error (s3_upload.js isn't precompiled): 2011-12-27T17:53:14+00:00 app[web.1]: 1: <div id="wrapper"> 2011-12-27T17:53:14+00:00 app[web.1]: 2: <h1>Uploader</h1> 2011-12-27T17:53:14+00:00 app[web.1]: 4: <input type="submit" value="Start Uploading" onclick="s3_swf_1_object.startUploading();" /> 2011-12-27T17:53:14+00:00 app[web.1]: 3: <%=raw s3_swf_upload_tag %> 2011-12-27T17:53:14+00:00 app[web.1]: 5: </div> 2011-12-27T17:53:14+00:00 app[web.1]: app/views/pages/home.html.erb : 3 : in `_app_views_pages_home_html_erb___2628368205308588842_20282460'

I have also tried running the following.

bundle exec rake assets:precompile

nathancolgate commented 12 years ago

In rails > 3.1 you will probably want to put the JavaScript file in the assets/javascripts folder instead of the default public/javascripts folder.

jeremywhittington commented 12 years ago

I moved s3_upload.js from public/javascripts to app/assets/javascripts however I am still seeing the same error. I have tried to rerun bundle exec rake assets:precompile.

I am still playing with it trying to understand but any help would be appreciated.

jeremywhittington commented 12 years ago

I figured it out, for anyone having this issue you must change config.assets.compile to true in config/environments/production.rb.

config.assets.compile = true

fabioruxo commented 12 years ago

Wow... config.assets.precompile just saved my life! Thanks for that :-)

casoetan commented 11 years ago

Saved my life as well. Thanks