To reproduce bug:
$ bundle install
$ ruby person.rb
An error is thrown when trying to use an ActiveRecord model:
ransack-1.6.3/lib/ransack/context.rb:30:in `for': Don't know what context to use for Person (ArgumentError)
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem 'activerecord' | |
| gem 'mongoid' | |
| gem 'sqlite3' | |
| gem 'ransack' |
| require 'bundler/setup' | |
| require 'active_record' | |
| require 'mongoid' | |
| require 'ransack' | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => 'sqlite3', | |
| :database => 'test.db' | |
| ) | |
| class CreatePerson < ActiveRecord::Migration | |
| def change | |
| create_table :people do |t| | |
| t.string :name | |
| t.timestamps | |
| end | |
| end | |
| end | |
| CreatePerson.migrate(:up) | |
| class Person < ActiveRecord::Base; end | |
| Person.ransack(name_contains: 'john') |