mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Merge branch 'master' of https://github.com/l15n/kaminari into l15n-master
This commit is contained in:
commit
0cb8722a51
8 changed files with 154 additions and 157 deletions
26
Gemfile
26
Gemfile
|
@ -1,25 +1,7 @@
|
|||
source 'http://rubygems.org'
|
||||
# Add dependencies required to use your gem here.
|
||||
# Example:
|
||||
# gem "activesupport", ">= 2.3.5"
|
||||
|
||||
# Add dependencies to develop your gem here.
|
||||
# Include everything needed to run rake, tests, features, etc.
|
||||
group :development do
|
||||
gem 'rspec', '>= 2.5.0'
|
||||
gem 'rr', '>= 1.0.2'
|
||||
gem 'steak', '>= 1.1.0'
|
||||
gem 'capybara', '>= 0.4.1.1'
|
||||
gem 'bundler', '>= 1.0.0'
|
||||
gem 'jeweler', '>= 1.5.2'
|
||||
gem 'rcov', '>= 0'
|
||||
gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||
# gem 'rails', '>= 3.0.3'
|
||||
gem 'rack', :git => 'git://github.com/rack/rack.git'
|
||||
gem 'arel', :git => 'git://github.com/rails/arel.git'
|
||||
gem 'rspec-rails', '>= 2.5.0'
|
||||
gem 'sqlite3', '>= 1.3.3'
|
||||
if RUBY_VERSION < '1.9'
|
||||
gem 'ruby-debug'
|
||||
gem 'mongoid', '2.0.0.rc.7'
|
||||
gem 'bson_ext', '~> 1.2'
|
||||
else
|
||||
gem 'ruby-debug19'
|
||||
end
|
||||
gemspec
|
||||
|
|
139
Gemfile.lock
139
Gemfile.lock
|
@ -1,69 +1,44 @@
|
|||
GIT
|
||||
remote: git://github.com/rack/rack.git
|
||||
revision: e3ffeac0dc04bb8d5994b7923bf12e55d549a279
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
rack (1.2.1)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rails/arel.git
|
||||
revision: dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980
|
||||
specs:
|
||||
arel (2.0.7.beta.20110121165657)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rails/rails.git
|
||||
revision: 829de9d98e59f9b083ed96a9031cd9841c83ae47
|
||||
specs:
|
||||
actionmailer (3.1.0.beta)
|
||||
actionpack (= 3.1.0.beta)
|
||||
mail (~> 2.2.15)
|
||||
actionpack (3.1.0.beta)
|
||||
activemodel (= 3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.5.0)
|
||||
rack (~> 1.2.1)
|
||||
rack-cache (~> 1.0.0)
|
||||
rack-mount (~> 0.6.13)
|
||||
rack-test (~> 0.5.7)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
bcrypt-ruby (~> 2.1.4)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.5.0)
|
||||
activerecord (3.1.0.beta)
|
||||
activemodel (= 3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
arel (~> 2.0.2)
|
||||
tzinfo (~> 0.3.23)
|
||||
activeresource (3.1.0.beta)
|
||||
activemodel (= 3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
activesupport (3.1.0.beta)
|
||||
rails (3.1.0.beta)
|
||||
actionmailer (= 3.1.0.beta)
|
||||
actionpack (= 3.1.0.beta)
|
||||
activerecord (= 3.1.0.beta)
|
||||
activeresource (= 3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.1.0.beta)
|
||||
railties (3.1.0.beta)
|
||||
actionpack (= 3.1.0.beta)
|
||||
activesupport (= 3.1.0.beta)
|
||||
rake (>= 0.8.7)
|
||||
thor (~> 0.14.4)
|
||||
kaminari (0.9.13)
|
||||
rails (>= 3.0.0)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
abstract (1.0.0)
|
||||
bcrypt-ruby (2.1.4)
|
||||
actionmailer (3.0.4)
|
||||
actionpack (= 3.0.4)
|
||||
mail (~> 2.2.15)
|
||||
actionpack (3.0.4)
|
||||
activemodel (= 3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
builder (~> 2.1.2)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.4)
|
||||
rack (~> 1.2.1)
|
||||
rack-mount (~> 0.6.13)
|
||||
rack-test (~> 0.5.7)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
builder (~> 2.1.2)
|
||||
i18n (~> 0.4)
|
||||
activerecord (3.0.4)
|
||||
activemodel (= 3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
arel (~> 2.0.2)
|
||||
tzinfo (~> 0.3.23)
|
||||
activeresource (3.0.4)
|
||||
activemodel (= 3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
activesupport (3.0.4)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (2.0.8)
|
||||
bson (1.2.2)
|
||||
bson_ext (1.2.2)
|
||||
builder (3.0.0)
|
||||
builder (2.1.2)
|
||||
capybara (0.4.1.2)
|
||||
celerity (>= 0.7.9)
|
||||
culerity (>= 0.2.4)
|
||||
|
@ -73,7 +48,7 @@ GEM
|
|||
rack-test (>= 0.5.4)
|
||||
selenium-webdriver (>= 0.0.27)
|
||||
xpath (~> 0.1.3)
|
||||
celerity (0.8.7)
|
||||
celerity (0.8.8)
|
||||
childprocess (0.1.7)
|
||||
ffi (~> 0.6.3)
|
||||
columnize (0.3.2)
|
||||
|
@ -89,9 +64,9 @@ GEM
|
|||
bundler (~> 1.0.0)
|
||||
git (>= 1.2.5)
|
||||
rake
|
||||
ruby-debug
|
||||
json_pure (1.5.1)
|
||||
linecache (0.43)
|
||||
linecache19 (0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.2.15)
|
||||
activesupport (>= 2.3.6)
|
||||
i18n (>= 0.4.0)
|
||||
|
@ -107,12 +82,24 @@ GEM
|
|||
will_paginate (~> 3.0.pre)
|
||||
nokogiri (1.4.4)
|
||||
polyglot (0.3.1)
|
||||
rack-cache (1.0)
|
||||
rack (>= 0.4)
|
||||
rack (1.2.1)
|
||||
rack-mount (0.6.13)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (0.5.7)
|
||||
rack (>= 1.0)
|
||||
rails (3.0.4)
|
||||
actionmailer (= 3.0.4)
|
||||
actionpack (= 3.0.4)
|
||||
activerecord (= 3.0.4)
|
||||
activeresource (= 3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.0.4)
|
||||
railties (3.0.4)
|
||||
actionpack (= 3.0.4)
|
||||
activesupport (= 3.0.4)
|
||||
rake (>= 0.8.7)
|
||||
thor (~> 0.14.4)
|
||||
rake (0.8.7)
|
||||
rcov (0.9.9)
|
||||
rr (1.0.2)
|
||||
|
@ -129,13 +116,18 @@ GEM
|
|||
activesupport (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
rspec (~> 2.5.0)
|
||||
ruby-debug (0.10.4)
|
||||
columnize (>= 0.1)
|
||||
ruby-debug-base (~> 0.10.4.0)
|
||||
ruby-debug-base (0.10.4)
|
||||
linecache (>= 0.3)
|
||||
ruby-debug-base19 (0.11.24)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby_core_source (0.1.4)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
rubyzip (0.9.4)
|
||||
selenium-webdriver (0.1.2)
|
||||
selenium-webdriver (0.1.3)
|
||||
childprocess (~> 0.1.5)
|
||||
ffi (~> 0.6.3)
|
||||
json_pure
|
||||
|
@ -155,18 +147,19 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
arel!
|
||||
arel
|
||||
bson_ext (~> 1.2)
|
||||
bundler (>= 1.0.0)
|
||||
capybara (>= 0.4.1.1)
|
||||
jeweler (>= 1.5.2)
|
||||
kaminari!
|
||||
mongoid (= 2.0.0.rc.7)
|
||||
rack!
|
||||
rails!
|
||||
rack
|
||||
rails
|
||||
rcov
|
||||
rr (>= 1.0.2)
|
||||
rspec (>= 2.5.0)
|
||||
rspec-rails (>= 2.5.0)
|
||||
ruby-debug
|
||||
ruby-debug19
|
||||
sqlite3 (>= 1.3.3)
|
||||
steak (>= 1.1.0)
|
||||
|
|
125
README.rdoc
125
README.rdoc
|
@ -1,35 +1,35 @@
|
|||
= Kaminari
|
||||
|
||||
A Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3
|
||||
A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3
|
||||
|
||||
|
||||
== Features
|
||||
|
||||
* Clean
|
||||
Does not globally pollute Array, Hash, Object or AR::Base.
|
||||
=== Clean
|
||||
Does not globally pollute +Array+, +Hash+, +Object+ or <tt>AR::Base</tt>.
|
||||
|
||||
* Easy to use
|
||||
Just bundle the gem, then your models are ready to be paginated. No configuration. Don't have to define anything in your models or helpers.
|
||||
=== Easy to use
|
||||
Just bundle the gem, then your models are ready to be paginated. No configuration required. Don't have to define anything in your models or helpers.
|
||||
|
||||
* Scope based simple API
|
||||
=== Simple scope-based API
|
||||
Everything is method chainable with less "Hasheritis". You know, that's the Rails 3 way.
|
||||
No special collection class or something for the paginated values but uses a general AR::Relation instance. So, of course you can chain any other conditions before or after the paginator scope.
|
||||
No special collection class or anything for the paginated values, instead using a general <tt>AR::Relation</tt> instance. So, of course you can chain any other conditions before or after the paginator scope.
|
||||
|
||||
* Engine based I18n aware customizable helper
|
||||
As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour or style or whatever by overriding partial templates.
|
||||
=== Customizable engine-based I18n-aware helper
|
||||
As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour, style or whatever by overriding partial templates.
|
||||
|
||||
* ORM, template engine agnostic
|
||||
=== ORM & template engine agnostic
|
||||
Kaminari supports multiple ORMs (ActiveRecord, Mongoid) and multiple template engines (ERB, Haml).
|
||||
|
||||
* Modern
|
||||
The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports the Rails 3 unobtrusive Ajax.
|
||||
=== Modern
|
||||
The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports Rails 3 unobtrusive Ajax.
|
||||
|
||||
|
||||
== Supported versions
|
||||
|
||||
* Ruby 1.8.7 and 1.9.2 and 1.9.3
|
||||
* Ruby 1.8.7, 1.9.2, 1.9.3
|
||||
|
||||
* Rails 3.0.x and 3.1
|
||||
* Rails 3.0.x, 3.1
|
||||
|
||||
* Haml 3
|
||||
|
||||
|
@ -43,68 +43,77 @@ Put this line in your Gemfile:
|
|||
Then bundle:
|
||||
% bundle
|
||||
|
||||
|
||||
== Usage
|
||||
|
||||
=== Query Basics
|
||||
|
||||
* the :page scope
|
||||
To fetch the 7th page of the users (per_page = 25 by default)
|
||||
User.page(7)
|
||||
* the +:page+ scope
|
||||
|
||||
* the :per scope
|
||||
To show a lot more users per each page (change the per_page value)
|
||||
User.page(7).per(50)
|
||||
Note that the :per scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use "per_page" without specifying the "page" number.
|
||||
To fetch the 7th page of users (default +per_page+ is 25)
|
||||
User.page(7)
|
||||
|
||||
=== Configuring default per_page value for each model
|
||||
* the +:per+ scope
|
||||
|
||||
* paginates_per
|
||||
You can specify default per_page value per each model using the following declarative DSL.
|
||||
class User < ActiveRecord::Base
|
||||
paginates_per 50
|
||||
end
|
||||
To show a lot more users per each page (change the +per_page+ value)
|
||||
User.page(7).per(50)
|
||||
Note that the +:per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number.
|
||||
|
||||
=== Configuring default +per_page+ value for each model
|
||||
|
||||
* +paginates_per+
|
||||
|
||||
You can specify default +per_page+ value per each model using the following declarative DSL.
|
||||
class User < ActiveRecord::Base
|
||||
paginates_per 50
|
||||
end
|
||||
|
||||
=== Controllers
|
||||
|
||||
* the page parameter is in params[:page]
|
||||
Typically, your controller code will look like this:
|
||||
@users = User.order(:name).page params[:page]
|
||||
* the page parameter is in <tt>params[:page]</tt>
|
||||
|
||||
Typically, your controller code will look like this:
|
||||
@users = User.order(:name).page params[:page]
|
||||
|
||||
=== Views
|
||||
|
||||
* the same old helper method
|
||||
Just call the "paginate" helper:
|
||||
<%= paginate @users %>
|
||||
|
||||
This will render several "?page=N" pagination links surrounded by an HTML5 <nav> tag.
|
||||
Just call the +paginate+ helper:
|
||||
<%= paginate @users %>
|
||||
|
||||
This will render several <tt>?page=N</tt> pagination links surrounded by an HTML5 <+nav+> tag.
|
||||
|
||||
=== Helper Options
|
||||
|
||||
* specifing the "inner window" size (4 by default)
|
||||
This would output something like ... 5 6 7 8 9 ... when 7 is the current page.
|
||||
<%= paginate @users, :window => 2 %>
|
||||
|
||||
This would output something like <tt>... 5 6 7 8 9 ...</tt> when 7 is the current page.
|
||||
<%= paginate @users, :window => 2 %>
|
||||
|
||||
* specifing the "outer window" size (1 by default)
|
||||
This would output something like 1 2 3 4 ...(snip)... 17 18 19 20 while having 20 pages in total.
|
||||
<%= paginate @users, :outer_window => 3 %>
|
||||
|
||||
* outer window can be separetely specified by "left", "right" (1 by default)
|
||||
This would output something like 1 ...(snip)... 18 19 20 while having 20 pages in total.
|
||||
<%= paginate @users, :left => 0, :right => 2 %>
|
||||
This would output something like <tt>1 2 3 4 ...(snip)... 17 18 19 20</tt> while having 20 pages in total.
|
||||
<%= paginate @users, :outer_window => 3 %>
|
||||
|
||||
* extra parameters (:params) for the links
|
||||
This would modify each link's url_option. :controller and :action might be the keys in common.
|
||||
<%= paginate @users, :params => {:controller => 'foo', :action => 'bar'}
|
||||
* outer window can be separetely specified by +left+ +right+ (1 by default)
|
||||
|
||||
This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total.
|
||||
<%= paginate @users, :left => 0, :right => 2 %>
|
||||
|
||||
* extra parameters (+:params+) for the links
|
||||
|
||||
This would modify each link's +url_option+. +:controller+ and +:action+ might be the keys in common.
|
||||
<%= paginate @users, :params => {:controller => 'foo', :action => 'bar'}
|
||||
|
||||
* Ajax links (crazy simple, but works perfectly!)
|
||||
This would add data-remote="true" to all the links inside.
|
||||
<%= paginate @users, :remote => true %>
|
||||
|
||||
This would add <tt>data-remote="true"</tt> to all the links inside.
|
||||
<%= paginate @users, :remote => true %>
|
||||
|
||||
=== I18n and labels
|
||||
|
||||
The default labels for 'previous', '...' and 'next' are stored in the I18n yaml inside the engine, and rendered through I18n API. You can switch the label value per I18n.locale for your internationalized application.
|
||||
Keys and the default values are the following. You can override them by adding to a YAML file in your Rails.root/config/locales directory.
|
||||
Keys and the default values are the following. You can override them by adding to a YAML file in your <tt>Rails.root/config/locales</tt> directory.
|
||||
|
||||
en:
|
||||
views:
|
||||
|
@ -118,22 +127,28 @@ Keys and the default values are the following. You can override them by adding t
|
|||
Kaminari includes a handy template generator.
|
||||
|
||||
* to edit your paginator
|
||||
Run the generator first,
|
||||
|
||||
Run the generator first,
|
||||
% rails g kaminari:views default
|
||||
|
||||
then edit the partials in your app's app/views/kaminari/ directory.
|
||||
then edit the partials in your app's <tt>app/views/kaminari/</tt> directory.
|
||||
|
||||
* for Haml users
|
||||
Haml templates generator is also available by adding "-e haml" option (this would actually be automatically invoked while the default template_engine is set to Haml).
|
||||
Haml templates generator is also available by adding the <tt>-e haml</tt> option (this is automatically invoked when the default template_engine is set to Haml).
|
||||
|
||||
% rails g kaminari:views default -e haml
|
||||
|
||||
* themes
|
||||
The generator has the ability to fetch several sample template themes from the external repository (https://github.com/amatsuda/kaminari_themes) in addition to the bundled "default" one, which will help you creating a nice looking paginator.
|
||||
% rails g kaminari:views THEME
|
||||
|
||||
To see the full list of avaliable themes, take a look at the themes repository, or just hit the generator without specifying THEME argument.
|
||||
% rails g kaminari:views
|
||||
The generator has the ability to fetch several sample template themes from
|
||||
the external repository (https://github.com/amatsuda/kaminari_themes) in
|
||||
addition to the bundled "default" one, which will help you creating a nice
|
||||
looking paginator.
|
||||
% rails g kaminari:views THEME
|
||||
|
||||
To see the full list of avaliable themes, take a look at the themes repository,
|
||||
or just hit the generator without specifying +THEME+ argument.
|
||||
% rails g kaminari:views
|
||||
|
||||
|
||||
== For more information
|
||||
|
@ -141,7 +156,7 @@ To see the full list of avaliable themes, take a look at the themes repository,
|
|||
Check out Kaminari recipes on the GitHub Wiki for more advanced tips and techniques.
|
||||
https://github.com/amatsuda/kaminari/wiki/Kaminari-recipes
|
||||
|
||||
== Questions, Feedbacks
|
||||
== Questions, Feedback
|
||||
|
||||
Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) ☇☇☇ :)
|
||||
|
||||
|
|
4
Rakefile
4
Rakefile
|
@ -17,7 +17,7 @@ Jeweler::Tasks.new do |gem|
|
|||
gem.name = "kaminari"
|
||||
gem.homepage = "http://github.com/amatsuda/kaminari"
|
||||
gem.license = "MIT"
|
||||
gem.summary = 'A pagnation engine plugin for Rails 3'
|
||||
gem.summary = 'A pagination engine plugin for Rails 3'
|
||||
gem.description = 'Kaminari is a Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3'
|
||||
gem.email = "ronnie@dio.jp"
|
||||
gem.authors = ["Akira Matsuda"]
|
||||
|
@ -53,4 +53,4 @@ end
|
|||
|
||||
task :test do
|
||||
Rake::Task[:spec].invoke
|
||||
end
|
||||
end
|
||||
|
|
|
@ -106,7 +106,6 @@ Gem::Specification.new do |s|
|
|||
s.add_development_dependency(%q<arel>, [">= 0"])
|
||||
s.add_development_dependency(%q<rspec-rails>, [">= 2.5.0"])
|
||||
s.add_development_dependency(%q<sqlite3>, [">= 1.3.3"])
|
||||
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
||||
s.add_development_dependency(%q<mongoid>, ["= 2.0.0.rc.7"])
|
||||
s.add_development_dependency(%q<bson_ext>, ["~> 1.2"])
|
||||
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
||||
|
@ -123,7 +122,6 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency(%q<arel>, [">= 0"])
|
||||
s.add_dependency(%q<rspec-rails>, [">= 2.5.0"])
|
||||
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
||||
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
||||
s.add_dependency(%q<mongoid>, ["= 2.0.0.rc.7"])
|
||||
s.add_dependency(%q<bson_ext>, ["~> 1.2"])
|
||||
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
||||
|
@ -141,7 +139,6 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency(%q<arel>, [">= 0"])
|
||||
s.add_dependency(%q<rspec-rails>, [">= 2.5.0"])
|
||||
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
||||
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
||||
s.add_dependency(%q<mongoid>, ["= 2.0.0.rc.7"])
|
||||
s.add_dependency(%q<bson_ext>, ["~> 1.2"])
|
||||
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
||||
|
|
|
@ -17,7 +17,9 @@ module Kaminari
|
|||
kls.class_eval do
|
||||
# Fetch the values at the specified page number
|
||||
# Model.page(5)
|
||||
scope :page, lambda {|num|
|
||||
scope :page, lambda {|*num|
|
||||
raise ArgumentError if num.size > 1
|
||||
num = num.first || 1
|
||||
limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
|
||||
} do
|
||||
# Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# encoding: UTF-8
|
||||
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
|
||||
|
||||
feature 'Users' do
|
||||
|
|
|
@ -3,7 +3,14 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|||
require 'rails'
|
||||
require 'mongoid'
|
||||
require 'kaminari'
|
||||
|
||||
# Ensure we use 'syck' instead of 'psych' in 1.9.2
|
||||
# RubyGems >= 1.5.0 uses 'psych' on 1.9.2, but
|
||||
# Psych does not yet support YAML 1.1 merge keys.
|
||||
# Merge keys is often used in mongoid.yml
|
||||
# See: http://redmine.ruby-lang.org/issues/show/4300
|
||||
if RUBY_VERSION >= '1.9.2'
|
||||
YAML::ENGINE.yamler = 'syck'
|
||||
end
|
||||
require File.join(File.dirname(__FILE__), 'fake_app')
|
||||
|
||||
require 'rspec/rails'
|
||||
|
|
Loading…
Reference in a new issue