【问题标题】:Heroku displaying pagination different from locallyHeroku 显示与本地不同的分页
【发布时间】:2017-04-05 08:00:27
【问题描述】:

我正在关注 Ruby on Rails 的在线教程。

似乎一切正常,但 Heroku 部署显示分页的不同页面。

跟随图片。 赫罗库:

本地: & 代码:

app/views/index.html.erb

<% provide(:title, 'All users') %>
<h1>All users</h1>
<%= will_paginate %>
<ul class="users">
  <%= render @users %>
</ul>
<%= will_paginate %>

app/views/users/_user.html.erb

<li>
  <%= gravatar_for user, size: 50 %>
  <%= link_to user.name, user %>
  <% if current_user.admin? && !current_user?(user) %>
    | <%= link_to "delete", user, method: :delete,
                                  data: { confirm: "You sure?" } %>
  <% end %>

</li>

custom.scss

...   
 /* Users index */

    .users {
      list-style: none;
      margin: 0;
      li {
        overflow: auto;
        padding: 10px 0;
        border-bottom: 1px solid $gray-lighter;
      }
    }

有什么线索吗?

【问题讨论】:

  • 您是否检查过开发者工具上的网络选项卡?可能没有正确加载资源。
  • 您是否担心用户在 Heroku 中没有很好地排列,或者不同的用户(或不同的用户顺序)显示在第一页?前者可能与分页无关,后者可能是。
  • @cjungel 我不确定我应该在那里看什么。但我在那里找到:“rocky-cove-64476.herokuapp.com/assets/…”我认为你是对的!我怎样才能使这个资源加载?
  • @CaptainChaos 我担心的是用户没有很好地排队! ;)
  • @FelipeMaion 错误是什么?是否未找到,该资源是否与网站的其他部分使用相同的协议提供服务,您是否检查过引用该资源的代码中的拼写错误?

标签: ruby ruby-on-rails-3 heroku pagination


【解决方案1】:

在@cjungel 的提示下,我找到了解决方案:

bundle exec rake assets:precompile
git add -A
git commit -m "Precompile assets"
git push
git push heroku

现在它正在工作!

【讨论】:

    猜你喜欢
    • 2013-06-16
    • 2019-02-12
    • 1970-01-01
    • 1970-01-01
    • 2010-12-22
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 2020-11-05
    相关资源
    最近更新 更多