Sha256: 78e6ecbecf2a11eda4e566030231e72a1e5584b7e7656a558a068c51fff726ee

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

require 'active_record'
require 'action_controller/railtie'
require 'action_view/railtie'

# database
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
ActiveRecord::Base.establish_connection('test')

# config
app = Class.new(Rails::Application)
app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
app.config.session_store :cookie_store, :key => "_myapp_session"
app.config.active_support.deprecation = :log
app.initialize!

# routes
app.routes.draw do
  resources :users
end

# models
class User < ActiveRecord::Base
  default_scope order(:name)
end
class Book < ActiveRecord::Base; end

# controllers
class ApplicationController < ActionController::Base; end
class UsersController < ApplicationController
  def index
    @users = User.page params[:page]
    render :inline => <<-ERB
<%= @users.map(&:name).join("\n") %>
<%= paginate @users %>
ERB
  end
end

# helpers
Object.const_set(:ApplicationHelper, Module.new)

#migrations
class CreateAllTables < ActiveRecord::Migration
  def self.up
    create_table(:users) {|t| t.string :name }
    create_table(:books) {|t| t.string :title }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kaminari-0.10.2 spec/fake_app.rb
kaminari-0.10.1 spec/fake_app.rb
kaminari-0.10.0 spec/fake_app.rb
kaminari-0.9.13 spec/fake_app.rb
kaminari-0.9.12 spec/fake_app.rb
kaminari-0.9.10 spec/fake_app.rb
kaminari-0.9.9 spec/fake_app.rb
kaminari-0.9.8 spec/fake_app.rb
kaminari-0.9.7 spec/fake_app.rb
kaminari-0.9.6 spec/fake_app.rb