1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/spec/fake_app/sinatra_app.rb
2012-05-23 12:54:54 +09:00

22 lines
719 B
Ruby

require 'fake_app/active_record/config' if defined? ActiveRecord
require 'fake_app/data_mapper/config' if defined? DataMapper
require 'fake_app/mongoid/config' if defined? Mongoid
require 'fake_app/mongo_mapper/config' if defined? MongoMapper
#models
require 'fake_app/active_record/models' if defined? ActiveRecord
require 'fake_app/data_mapper/models' if defined? DataMapper
require 'fake_app/mongoid/models' if defined? Mongoid
require 'fake_app/mongo_mapper/models' if defined? MongoMapper
class SinatraApp < Sinatra::Base
register Kaminari::Helpers::SinatraHelpers
get '/users' do
@users = User.page params[:page]
erb <<-ERB
<%= @users.map(&:name).join("\n") %>
<%= paginate @users %>
ERB
end
end