Answer the question
In order to leave comments, you need to log in
Why does the markup on the page disappear when the kaminari-sinatra gem is included?
Why does the markup on the page disappear when the kaminari-sinatra gem is included?
app.rb
require 'bundler/setup'
Bundler.require
Mongoid.load!(File.expand_path('../mongodb.yml', __FILE__), :development)
configure do
set :public_folder, 'public'
register Kaminari::Helpers::SinatraHelpers
end
class Post
include Mongoid::Document
field :title, type: String
field :description, type: String
end
get '/' do
@posts = Post.page(params[:page]).per(5)
erb :'posts/index'
end
gem 'sinatra'
gem 'puma'
gem 'mongoid'
gem 'kaminari-sinatra'
gem 'kaminari-mongoid'
<h1>All posts</h1>
<% @posts.each do |post| %>
Title: <%= post.title %><br>
Description: <%= post.description %><br>
<% end %>
<%= paginate @posts %>
<html>
<head>
<title>Home page</title>
<link rel="stylesheet" href="/stylesheets/foundation.min.css">
</head>
<body>
<div class="grid-container">
<div class="grid-x">
<div class="cell">
<div class="top-bar">
<div class="top-bar-left">
<ul class="dropdown menu" data-dropdown-menu>
<li><a href="/">Home</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid-x">
<div class="cell"><%= yield %></div>
</div>
</div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question