I use rails 3.1.0.rc5 and backbone.js and I have a problem with deploying rails applications on heroku, although on my local host everything works fine. I pushed the application to Hiroko and migrated database and I got these errors: (log heroku )
Started GET "/providers" for 217.147.160.139 at 2011-08-15 05:20:57 -0700
2011-08-15T12:20:57+00:00 app[web.1]: Processing by ProvidersController#index as HTML
2011-08-15T12:20:57+00:00 app[web.1]: Rendered providers/index.html.erb within
layouts/application (0.4ms)
2011-08-15T12:20:57+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2011-08-15T12:20:57+00:00 app[web.1]:
2011-08-15T12:20:57+00:00 app[web.1]: ActionView::Template::Error (Not a directory -
/app/app/assets/application.js):
2011-08-15T12:20:57+00:00 app[web.1]: 2: <html>
2011-08-15T12:20:57+00:00 app[web.1]: 3: <head>
2011-08-15T12:20:57+00:00 app[web.1]: 4: <title>Providers</title>
2011-08-15T12:20:57+00:00 app[web.1]: 5: <%= stylesheet_link_tag "application",
"sw_on_backbone" %>
2011-08-15T12:20:57+00:00 app[web.1]: 6: <%= javascript_include_tag "application",
"backbone/sw_on_bckb" %>
2011-08-15T12:20:57+00:00 app[web.1]: 7: <%= csrf_meta_tags %>
2011-08-15T12:20:57+00:00 app[web.1]: 8: </head>
2011-08-15T12:20:57+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in
"_app_views_layouts_application_html_erb___1529301457241305386_13879700"
2011-08-15T12:20:57+00:00 app[web.1]: app/controllers/providers_controller.rb:7:in `index'
2011-08-15T12:20:57+00:00 app[web.1]:
2011-08-15T12:20:57+00:00 app[web.1]:
2011-08-15T12:20:57+00:00 app[web.1]: cache: [GET /providers] miss
my Gemfile:
2 gem "rails-backbone"
3 gem 'execjs'
4 gem 'therubyracer'
5 gem 'rails', '3.1.0.rc5'
6 gem 'arel','2.1.4'
7 gem 'rake', '0.9.2'
8 gem 'heroku'
9 gem 'pg'
10 gem 'sprockets'
11 # Bundle edge Rails instead:
12 # gem 'rails', :git => 'git://github.com/rails/rails.git'
13 gem 'sqlite3'
14
15 # Asset template engines
16 gem 'sass-rails'
17 gem 'coffee-script'
18 gem 'uglifier'
19
20 gem 'jquery-rails'
21
22 # Use unicorn as the web server
23 # gem 'unicorn'
24
25 # Deploy with Capistrano
26 # gem 'capistrano'
27
28 # To use debugger
29 # gem 'ruby-debug19', :require => 'ruby-debug'
30
31 group :test do
32 # Pretty printed test output
33 gem 'turn', :require => false
34 end
I think the problem is broken sprotskets, although I used the latest version (sprockets (2.0.0.beta.13)).
$ gem list
actionmailer (3.1.0.rc5, 3.1.0.rc4)
actionpack (3.1.0.rc5, 3.1.0.rc4)
activemodel (3.1.0.rc5, 3.1.0.rc4)
activerecord (3.1.0.rc5, 3.1.0.rc4)
activeresource (3.1.0.rc5, 3.1.0.rc4)
activesupport (3.1.0.rc5, 3.1.0.rc4)
addressable (2.2.6)
ansi (1.3.0)
arel (2.1.5, 2.1.4, 2.1.3)
bcrypt-ruby (2.1.4)
builder (3.0.0)
bundler (1.0.15)
chunky_png (1.2.1)
coffee-rails (3.1.0.rc.5)
coffee-script (2.2.0)
coffee-script-source (1.1.2, 1.1.1)
compass (0.11.5)
ejs (1.0.0)
erubis (2.7.0)
execjs (1.2.4, 1.2.0)
fssm (0.2.7)
heroku (2.4.1, 2.3.6)
hike (1.2.0, 1.1.0)
i18n (0.6.0)
jquery-rails (1.0.13, 1.0.12)
launchy (2.0.5, 2.0.3)
libv8 (3.3.10.2 x86-linux)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
open4 (1.1.0)
pg (0.11.0)
Platform (0.4.0)
polyglot (0.3.2, 0.3.1)
POpen4 (0.1.4)
postgres-pr (0.6.3)
rack (1.3.2, 1.3.1, 1.3.0)
rack-cache (1.0.2)
rack-mount (0.8.2, 0.8.1)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.6.0)
rails (3.1.0.rc5)
rails-backbone (0.5.3, 0.5.2, 0.5.1, 0.2.0 )
railties (3.1.0.rc5, 3.1.0.rc4)
rake (0.9.2, 0.8.7)
开发者_运维问答rdoc (3.9.2, 3.9.1, 3.8)
rest-client (1.6.3)
sass (3.1.7, 3.1.5, 3.1.4)
sass-rails (3.1.0.rc.5, 3.1.0.rc.4)
sprockets (2.0.0.beta.13)
sqlite3 (1.3.4, 1.3.3)
term-ansicolor (1.0.6, 1.0.5)
therubyracer (0.9.3, 0.9.2)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.10, 1.4.9)
turn (0.8.2)
tzinfo (0.3.29)
uglifier (1.0.0)
yui-compressor (0.9.6)
The path for stylesheet_link_tag and javascript_include_tag is broken ( /app/app/assets/application.js) (in logs heroku). Thanks for help.
Precompiling the assets solved this problem for me. In order to do this, run this command:
bundle exec rake assets:precompile
That will create the folder public/assets, which will contain all your precompiled assets. Push all the generated files to Heroku.
Also, Heroku requires that config.assets.initialize_on_precompile be set to false in the config/application.rb file.
To find out more about precompiling assets in Rails, see here: http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
精彩评论