1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Update templates

- Ransack does not Rails master branch aka 6.2.0.alpha yet
- polyamorous is now part of ransack
- sqlite3 adapter default boolean changed from `'t'/'f'` to `1/0`
Refer 52e050ed00
- Apply RuboCop auto correct
This commit is contained in:
Yasuo Honda 2020-12-29 00:28:16 +09:00
parent 084085dd82
commit 3ab938897f
2 changed files with 5 additions and 7 deletions

View file

@ -12,14 +12,13 @@ unless File.exist?('Gemfile')
source 'https://rubygems.org'
# Rails master
gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails', branch: '6-1-stable'
# Rails last release
# gem 'rails'
gem 'sqlite3'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
GEMFILE
system 'bundle install'
@ -65,7 +64,7 @@ class BugTest < Minitest::Test
sql = User.ransack({ activated: true }).result.to_sql
puts sql
assert_equal(
"SELECT \"users\".* FROM \"users\" WHERE \"users\".\"active\" = 't'", sql
"SELECT \"users\".* FROM \"users\" WHERE \"users\".\"active\" = 1", sql
)
end

View file

@ -10,14 +10,13 @@ unless File.exist?('Gemfile')
source 'https://rubygems.org'
# Rails master
gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails', branch: '6-1-stable'
# Rails last release
# gem 'rails'
gem 'sqlite3'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
GEMFILE
system 'bundle install'
@ -61,11 +60,11 @@ end
class BugTest < Minitest::Test
def test_ransackers
sql = Project.ransack({number_present: 1}).result.to_sql
sql = Project.ransack({ number_present: 1 }).result.to_sql
puts sql
assert_equal "SELECT \"projects\".* FROM \"projects\" WHERE (\"projects\".\"number\" IS NOT NULL AND \"projects\".\"number\" != '')", sql
sql = Project.ransack({name_present: 1}).result.to_sql
sql = Project.ransack({ name_present: 1 }).result.to_sql
puts sql
assert_equal "SELECT \"projects\".* FROM \"projects\" WHERE (projects.name IS NOT NULL AND projects.name != '')", sql
end