我正在尝试使用smart_listing gem从表中检索数据。但我有多个问题。我意识到只有当我从“views / layouts / application.html.erb”中删除以下行时才会出现错误。
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag "application" %>
但那会搞砸我的整个应用程序。 有谁知道解决方法?看来这个宝石有很多问题。
我的控制器看起来像:
class DistribsController < ApplicationController
include SmartListing::Helper::ControllerExtensions
helper SmartListing::Helper
def index
smart_listing_create :contacts, Contact.all, partial: "distribs/list"
end
end
我的_list.html.haml看起来像:
- unless smart_listing.empty?
%table.table.table-striped
%thead
-# Second argument of sortable is sorted attribute name
%th.col-md-3= smart_listing.sortable "Name", "name"
%th.col-md-3= "Phone"
%th.col-md-4= smart_listing.sortable "Location", "location"
%th
%span.glyphicon.glyphicon-shopping-cart{title: "Has credit card?"}
%th.col-md-2= smart_listing.sortable "Wallet saldo", "saldo"
%tbody
- smart_listing.collection.each do |o|
%tr
-# User row goes here...
= smart_listing.paginate
= smart_listing.pagination_per_page_links
- else
%p.warning No records!
index.html.haml看起来像:
= smart_listing_render:联系人 index.js.erb看起来像:
<%= smart_listing_update :contacts %>