ruby-on-rails - 生产中的 Rails Assets 出现问题

标签 ruby-on-rails heroku asset-pipeline production

我跑了

rake assets:precompile
RAILS_ENV=production rake assets:precompile
git add -A
git commit -m "message"
git push heroku master

这是实时站点 - http://www.collegeinsideview.com/ .

似乎没有任何资源可用。我不明白为什么。

  • precompile 两者命令似乎有效。
  • 在开发中,我的public/assets/文件夹中充满了 Assets (末尾有指纹;例如 adelphi_social_atmosphere_7-c13258f14849b2f66e162688b9c9228f.png )。
  • 推送到 heroku 时没有出现任何错误。

生产.rb

Collegeanswers::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Add the fonts path
  config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = true

  config.assets.js_compressor  = :uglifier
  config.assets.css_compressor = :sass

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = true

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to nil and saved in location specified by config.assets.prefix
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # See everything in the log (default is :info)
  # config.log_level = :debug

  # Prepend all log lines with the following tags
  # config.log_tags = [ :subdomain, :uuid ]

  # Use a different logger for distributed setups
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

  # Use a different cache store in production
  # config.cache_store = :mem_cache_store

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

   # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  config.assets.precompile += %w( about_college.css college_pages.css colleges.css essay_list.css 
  essays.css home.css layout.css static_pages.css tldr.css college_pages.js essays.js home.js static_pages.js favicon.ico .svg .eot .woff .ttf)

  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # config.action_controller.asset_host = "https://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"

  config.eager_load = true
end

home.html

<% content_for(:title, 'College Inside View') %>

<div id="home_css">
    <!--<%= link_to "Get Paid to Answer Questions", "/the-deal", id: "the_deal", class: "btn btn-link" %>-->
    <h1 id="heading">In-Depth Reviews of Colleges</h1>
    <div class="tabbable">
        <div class="tab-content">
            <div class="tab-pane fade active in" id="columbia">
                <div class="left_pane">
                    <%= image_tag "columbia1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "columbia2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "columbia3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Columbia &bull; &bull;".html_safe, "/columbia/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>How does the workload impact your social life?</strong></p>
                    <%= image_tag "columbia_social_atmosphere_7.png", class: 'answers' %>
                    <%= link_to '--read more--', '/columbia/social-life/social-atmosphere/7', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="princeton">
                <div class="left_pane">
                    <%= image_tag "princeton1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "princeton2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "princeton3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Princeton &bull; &bull;".html_safe, "/princeton/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>How would you make your classes better?</strong></p>
                    <%= image_tag "princeton_classes_6.png", class: 'answers' %>
                    <%= link_to '--read more--', '/princeton/academics/classes/6', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="brown">
                <div class="left_pane">
                    <%= image_tag "brown1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "brown2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "brown3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Brown &bull; &bull;".html_safe, "/brown/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Are people intellectual? Do they have thoughtful conversations with each other?</strong></p>
                    <%= image_tag "brown_social_atmosphere_5.png", class: 'answers' %>
                    <%= link_to '--read more--', '/brown/social-life/social-atmosphere/5', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="penn">
                <div class="left_pane"> 
                    <%= image_tag "university-of-pennsylvania1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-pennsylvania2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-pennsylvania3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Penn &bull; &bull;".html_safe, "/university-of-pennsylvania/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Are your classes too hard, or too easy? Why?</strong></p>
                    <%= image_tag "penn_dificulty_4.png", class: 'answers' %>
                    <%= link_to '--read more--', '/university-of-pennsylvania/academics/difficulty/4', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="yale">
                <div class="left_pane"> 
                    <%= image_tag "yale1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "yale2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "yale3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Yale &bull; &bull;".html_safe, "/yale/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Is it easy to make friends? How did you make friends?</strong></p>
                    <%= image_tag "yale_social_atmosphere_1.png", class: 'answers' %>
                    <%= link_to '--read more--', '/yale/social-life/social-atmosphere/1', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="cornell">
                <div class="left_pane"> 
                    <%= image_tag "cornell1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "cornell2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "cornell3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Cornell &bull; &bull;".html_safe, "/cornell/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Mary Donlon Hall</strong></p>
                    <%= image_tag "cornell_housing_mary_donlon_hall.png", class: 'answers' %>
                    <%= link_to '--read more--', '/cornell/living-environment/housing/mary-donlon-hall', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="harvard">
                <div class="left_pane"> 
                    <%= image_tag "harvard1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "harvard2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "harvard3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Harvard &bull; &bull;".html_safe, "/harvard/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Are there comfortable places to study?</strong></p>
                    <%= image_tag "harvard_campus_2.png", class: 'answers' %>
                    <%= link_to '--read more--', '/harvard/academics/classes/5', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="dartmouth">
                <div class="left_pane"> 
                    <%= image_tag "dartmouth1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "dartmouth2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "dartmouth3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Dartmouth &bull; &bull;".html_safe, "/dartmouth/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Do professors make things easy to understand?</strong></p>
                    <%= image_tag "dartmouth_professors_1.png", class: 'answers' %>
                    <%= link_to '--read more--', '/dartmouth/academics/professors/1', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="pitt">
                <div class="left_pane"> 
                    <%= image_tag "university-of-pittsburgh1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-pittsburgh2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-pittsburgh3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Pitt &bull; &bull;".html_safe, "/university-of-pittsburgh/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Neuroscience: What are people in the major like? How would you stereotype them?</strong></p>
                    <%= image_tag "pitt_neuroscience_8.png", class: 'answers' %>
                    <%= link_to '--read more--', '/university-of-pittsburgh/academics/majors/neuroscience/8', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="wisconsin">
                <div class="left_pane"> 
                    <%= image_tag "university-of-wisconsin1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-wisconsin2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "university-of-wisconsin3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Wisconsin &bull; &bull;".html_safe, "/university-of-wisconsin/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>How much will not partying limit your social life?</strong></p>
                    <%= image_tag "wisconsin_parties_3.png", class: 'answers' %>
                    <%= link_to '--read more--', '/university-of-wisconsin/social-life/parties/3', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="colgate">
                <div class="left_pane"> 
                    <%= image_tag "colgate1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "colgate2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "colgate3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Colgate &bull; &bull;".html_safe, "/colgate/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>Who wouldn't fit in?</strong></p>
                    <%= image_tag "colgate_social_atmosphere_2.png", class: 'answers' %>
                    <%= link_to '--read more--', '/colgate/social-life/social-atmosphere/2', class: 'read_more' %>
                </div>
            </div>
            <div class="tab-pane fade" id="adelphi">
                <div class="left_pane"> 
                    <%= image_tag "adelphi-university1.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "adelphi-university2.jpg", size: "297x187", class: 'picture' %>
                    <%= image_tag "adelphi-university3.jpg", size: "297x187", class: 'picture' %>
                    <%= link_to "&bull; &bull; Read more about Adelphi &bull; &bull;".html_safe, "/adelphi-university/academics/professors/1", class: 'school_link' %>
                </div>
                <div class="right">
                    <p class="question" class="well"><strong>How's the on-campus food (taste, price, health, convenience, hours, variety...)?</strong></p>
                    <%= image_tag "adelphi_food_1.png", class: 'answers' %>
                    <%= link_to '--read more--', '/adelphi-university/living-environment/food/1', class: 'read_more' %>
                </div>
            </div>
        </div>
        <ul id="left" class="nav nav-pills nav-stacked">
            <li id="columbia" class="active"><a href="#columbia">Columbia</a></li>
            <li id="princeton"><a href="#princeton">Princeton</a></li>
            <li id="brown"><a href="#brown">Brown</a></li>
            <li id="penn"><a href="#penn">Penn</a></li>

            <li id="yale"><a href="#yale">Yale</a></li>
            <li id="cornell"><a href="#cornell">Cornell</a></li>
            <li id="harvard"><a href="#harvard">Harvard</a></li>
            <li id="dartmouth"><a href="#dartmouth">Dartmouth</a></li>

            <li id="pitt"><a href="#pitt">Pitt</a></li>
            <li id="wisconsin"><a href="#wisconsin">Wisconsin</a></li>
            <li id="colgate"><a href="#colgate">Colgate</a></li>
            <li id="adelphi"><a href="#adelphi">Adelphi</a></li>
        </ul>
    </div>

    <div id="notify">
        <p>Right now I only have reviews for those 12 schools. Enter your email below to be notified when there's more!</p>
        <span id="notify_span">
            <%= simple_form_for :subscribe, url: 'subscribe' do |f| %>
                <%= f.input :email, placeholder: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a0f091f083a1e15171b131454191517" rel="noreferrer noopener nofollow">[email protected]</a>', label: false, required: true %> <br/>
                <%= f.button :submit, "1-Click Sign Up", class: "btn btn-primary", data: { :disable_with => "Submitting..." } %>
            <% end %>
        </span>     
    </div>

    <ul id="bottom_links">
        <li><%= link_to "I Graduated High School. Now What?", "/i-graduated-high-school-now-what" %></li>
        <li><%= link_to "How to Choose a College", "/how-to-choose-a-college" %></li>
        <li><%= link_to "How College Inside View Got Started", "https://medium.com/what-i-learned-building/322e8668ed6f" %></li>
    </ul>

    <!--<section id="section1">
        <h1 id="main_head">Answers to the questions<br />
        that go unasked.<br /><br />
        <em>Finally!</em></h1>
        <section id="example_questions">
            <ul>
                <li><span class="label label-info">Academics</span> What are the people in the economics major like? How would you stereotype them?</li>
                <li><span class="label label-info">Academics</span> Would you go to class if you didn't have to?</li>
                <li><span class="label label-info">Living Environment</span> Where can you go to get groceries?</li>
                <li><span class="label label-info">Living Environment</span> What is Panther Hall like (social, comfortable, location...)?</li>
                <li><span class="label label-info">Social Life</span> Are people intellectual? Do they have thoughtful conversations with each other?</li>
                <li><span class="label label-info">Social Life</span> Are there any good school sponsored events, or do they all suck?</li>
                <li><span class="label label-info">Social Life</span> How much will not partying limit your social life?</li>
                <li><span class="label label-info">About College</span> Who are the people involved in teaching a class? What is a TA? UTA? What background/training/qualifications do they have?</li>
                <li><span class="label label-info">About College</span> How does social life change as you become an upperclassman?</li>
            </ul>
        </section>
    </section>
    <section id="section2" class="bottom_sections">
        <br /><br /><br /><br />
        <ul>
            <li>The best way to choose a college is to read student reviews. <%= image_tag "reviews.jpg", size: "200x200", id: 'reviews' %></li>
            <hr />
            <li>But student reviews are only as good as the questions that they ask. <%= image_tag "question_mark.jpg", size: "200x200", id: 'question_mark' %></li>
            <hr />
            <li>Right now, student reviews only ask <%= link_to "a small fraction", "https://www.dropbox.com/s/p75pspbd5suzz19/Questions%20Comparison%20pdf.pdf" %> of the questions that you want answered. <br /><%= image_tag "partial_chart.jpg", size: "200x200", id: 'partial_chart' %></li>
            <hr />
            <li>College Inside View asks them all. <%= image_tag "full_chart.jpg", size: "200x200", id:'full_chart' %></li>
            <hr />
            <li class="wide">
                Right now I'm doing a pilot program at the Ivies, and have over 4,000 answers for them so far. Previously I did a pilot program at <%= link_to "Pitt", "/university-of-pittsburgh/academics/professors/1" %>, <%= link_to "Wisconsin", "/university-of-wisconsin/academics/professors/1" %>, <%= link_to "Colgate", "/colgate/academics/professors/1" %> and <%= link_to "Adelphi", "/adelphi-university/academics/professors/1" %>. If you'd like to be notified when more schools get reviews, enter your email below:
                <span id="notify">
                    <%= simple_form_for :subscribe, url: 'subscribe' do |f| %>
                        <%= f.input :email, label: false, required: true %> <br/>
                        <%= f.button :submit, "Notify me", class: "btn btn-primary", data: { :disable_with => "Submitting..." } %>
                    <% end %>
                </span> 
            </li>
            <hr />
            <li class="wide">
                <small><em>*Also, if you like what I'm doing and know someone in college, please ask them to answer some questions about their school on this site!*</em></small>
                <p id="sample_post">Sample post: "College reviews are too broad. Please help answer some more specific questions about your school!"</p>
                <p><%= social_share_button_tag('College reviews are too broad. Please help answer some more specific questions about your school!') %></p>
            </li>
        </ul>
    </section>
    <section id="section3" class="bottom_sections">
        <h1>Where to start</h1>
        <ul>
            <li>Check out some of the articles in the <%= link_to "Advice Section", "/advice" %>. I'd start with this sequence:
              <ul>
                <li><%= link_to "I Graduated High School, Now What?", "/i-graduated-high-school-now-what" %></li>
                <li><%= link_to "The Process of Exploring Your Interests", "/the-process-of-exploring-your-interests" %></li>
                <li><%= link_to "How to Choose a College", "/how-to-choose-a-college" %></li>
              </ul>
            </li>
            <li>If you're unclear as to what college is like, check out the <%= link_to "About College", "/about-college/college-life/1" %> section.</li>
            <li>If you're ready to look for a school, start off by narrowing it down with the <%= link_to "Advanced Search", tools_advanced_search_url %> and <%= link_to "College Comparison", tools_comparison_url %> tools. Then <%= link_to "read about", "/colleges" %> the schools that you're interested in.</li>
            <li>If you have any questions about anything whatsoever, please <%= mail_to "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9a8b3acbba7acbbfa89aea4a8a0a5e7aaa6a4" rel="noreferrer noopener nofollow">[email protected]</a>", "shoot me an email" %>. I want to help. I just graduated Pitt as a neuroscience major, and can help you with anything from high school troubles, to the choosing a school, to succeeding in college.</li>
        </ul>
    </section>
    <section id="section4" class="bottom_sections">
        <h1>More information</h1>
        <ul>
            <li>See <%= link_to "my pitch", "/pitch" %> for an explanation of what makes College Inside View great.</li>
            <li>See also <%= link_to "how College Inside View got started", "https://medium.com/what-i-learned-building/322e8668ed6f" %>.</li>
            <li>Angel List <%= link_to "profile", "https://angel.co/college-inside-view" %></li>
            <li>Stuff I've <%= link_to "wrote", "https://medium.com/@adamzerner/latest" %>.</li>
        </ul>
    </section> -->
</div>

Gemfile

source 'https://rubygems.org'

ruby '2.0.0'
gem 'rails', '~>4.0.0'
gem 'bootstrap-sass', '2.3.2.0'
gem "actionmailer", "~> 4.0.3" #
gem "jquery-tablesorter", "~> 1.5.0"
gem 'jquery-rails'
gem 'meta-tags', :require => 'meta_tags'
gem "simple_form", "~> 3.0.1"
gem 'rails4_upgrade'
gem 'sass-rails', '~>4.0.0'
gem 'coffee-rails', '~>4.0.0'
gem 'uglifier', '>=1.3.0'
# gem 'asset_sync'
gem 'gibbon', '~> 1.1.2'
gem 'activerecord-tableless'
gem 'social-share-button'

# Rails 4 gems
gem 'actionpack-action_caching', '~>1.0.0'
gem 'actionpack-page_caching', '~>1.0.0'
gem 'actionpack-xml_parser', '~>1.0.0'
gem 'actionview-encoded_mail_to', '~>1.0.4'
gem "activerecord-session_store", "~> 0.1.0"
gem "activeresource", "~> 4.0.0" #
gem "actionpack", "~> 4.0.3" #
gem 'protected_attributes' #
gem "activemodel", "~> 4.0.3" #
gem 'rails-observers', '~>0.1.1'
gem 'dalli', '~> 2.6.2' #
# gem 'turbolinks'
# gem 'jquery-turbolinks'

group :production do
    gem 'pg'
    gem 'rails_12factor'
end

group :development do
    gem 'sqlite3'
    gem 'annotate', '2.5.0'
end




# Don't think I'm using these
gem 'jquery-ui-rails'
gem 'jquery-ui-themes'

一些heroku日志

2014-12-28T20:26:25.937063+00:00 app[web.1]:
2014-12-28T20:26:25.937075+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-12-28T20:26:25.937071+00:00 app[web.1]:
2014-12-28T20:26:25.937042+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-12-28T20:26:25.927220+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-12-28T20:26:25.937040+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:20:in `call'
2014-12-28T20:26:25.937072+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/adelphi_food_1-30d1a701653e3ce27c72d338a617333a.png"):
2014-12-28T20:26:25.937093+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-12-28T20:26:25.937100+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-12-28T20:26:25.937095+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:97:in `call'
2014-12-28T20:26:25.937084+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:20:in `call'
2014-12-28T20:26:25.937085+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-12-28T20:26:25.937087+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-12-28T20:26:25.937088+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-12-28T20:26:25.937061+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-12-28T20:26:25.937062+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-12-28T20:26:25.937051+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/engine.rb:511:in `call'
2014-12-28T20:26:25.937098+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-12-28T20:26:25.937101+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-12-28T20:26:25.937113+00:00 app[web.1]:
2014-12-28T20:26:25.937114+00:00 app[web.1]:
2014-12-28T20:26:25.937091+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-12-28T20:26:25.937078+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:20:in `block in call'
2014-12-28T20:26:25.937090+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-12-28T20:26:25.937097+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-12-28T20:26:25.937103+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-12-28T20:26:25.937111+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

最佳答案

为了在 Heroku 上部署和提供 Rails 4 静态资源,您必须在 Gemfile 的 prod 组中包含rails12_factor Gem。

gem 'rails_12factor', group: :production

此外,您必须确认 config/application.rbserve_static_assets 设置为 true。

config.serve_static_assets = true

查看Heroku documentation了解更多信息。

关于ruby-on-rails - 生产中的 Rails Assets 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27649691/

相关文章:

ruby-on-rails - 在 Heroku 上的 ImageMagick 中使用自定义字体

ruby-on-rails - Ruby on rails 测试 - 表 X 没有名为 Y 的列

ruby-on-rails - Turbolinks Rails 5的浏览器后退按钮上的JQuery插件初始化

ruby-on-rails - 制作一个 form_for 将数据添加到现有模型(rails)

dojo - 如何将dojo工具包与rails 3.1 Assets 管道和coffeescript一起使用?

javascript - Rails 递归地包含 javascripts Assets 文件夹

javascript - 是否可以在没有 web dyno 的情况下将 Node.js 应用程序部署到 Heroku?

ruby-on-rails - 为什么 heroku 在 gemfile 的开发部分下跳过 gem?

java - Jedis:Bean 属性 'maxActive' 不可写或具有无效的 setter 方法

ruby-on-rails - wicked_pdf: ActionView::Template::Error(找不到文件 'twitter/bootstrap'