ransack 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ed8cd2219b1b16fb129d708c135405bcc3cd1e1
4
- data.tar.gz: 08ee652b2fcbbf30f40ee7d7370d9d3fb4a97207
3
+ metadata.gz: 8dc4a8f835fc26d7d315572626021b65eb52c4ed
4
+ data.tar.gz: 79a2066b2c62fa03718561266d7b9a9219f31b96
5
5
  SHA512:
6
- metadata.gz: 3e1fb6f045a7f24db09af20e541d502f70793adea5f1ae5518f5ebdac9f22e8d60c884693a2858c35bf08b577ef32f6fafd412d046c2450d7b5b23935088bdd5
7
- data.tar.gz: c4886f5a0a91bd50df8336eb7cbe971ffdeae7cd36b4a3441d509676267f7236c1c3d10602c8fb7cd780ff0873216566240b27001012a77beecaca1cd21c0d27
6
+ metadata.gz: e315ac655c3acd20683166b2444d535abeaeeefb525af68740235fff805483ce230d483fe968ace4432141aa47fbb38d413b906dccaeff9c8e50b39e30347567
7
+ data.tar.gz: a4de93cc2211f753183182645ce5f8c8810af8b60d3687d3b9bccb07e303c63dd50296a9e61ba8b2cce04efa8fe91c2d1b6303551869a2870fe3abed3e2391b3
@@ -1,8 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## Version 1.6.2 - 2015-01-14
4
+
5
+ * Fix a regression
6
+ ([#494](https://github.com/activerecord-hackery/ransack/issues/494))
7
+ where passing an array of routes of `search_form_for` no longer worked,
8
+ and add a failing/passing test that would have caught the issue.
9
+
10
+ *Daniel Rikowski*, *Jon Atack*
11
+
12
+
3
13
  ## Version 1.6.1 - 2015-01-14
4
14
 
5
- * Fix a regression with using `in` predicates caused by PR [#488](https://github.com/activerecord-hackery/ransack/pull/488)). Add a test.
15
+ * Fix a regression with using `in` predicates caused by PR [#488](https://github.com/activerecord-hackery/ransack/pull/488)) and add a test.
6
16
 
7
17
  * README improvements to clarify `sort_link` syntax with associations and
8
18
  Ransack#search vs #ransack.
data/README.md CHANGED
@@ -27,7 +27,8 @@ instead.
27
27
  If you're viewing this at
28
28
  [github.com/activerecord-hackery/ransack](https://github.com/activerecord-hackery/ransack),
29
29
  you're reading the documentation for the master branch with the latest features.
30
- [View documentation for the last release (1.6.0).](https://github.com/activerecord-hackery/ransack/tree/v1.6.1)
30
+ [View documentation for the last release (1.6.2).]
31
+ (https://github.com/activerecord-hackery/ransack/tree/v1.6.2)
31
32
 
32
33
  ## Getting started
33
34
 
@@ -12,15 +12,15 @@ module Ransack
12
12
  options[:url] ||= polymorphic_path(
13
13
  search.klass, format: options.delete(:format)
14
14
  )
15
- elsif record.is_a? Array &&
16
- (search = record.detect { |o| o.is_a? Ransack::Search })
15
+ elsif record.is_a?(Array) &&
16
+ (search = record.detect { |o| o.is_a?(Ransack::Search) })
17
17
  options[:url] ||= polymorphic_path(
18
- record.map { |o| o.is_a? Ransack::Search ? o.klass : o },
18
+ record.map { |o| o.is_a?(Ransack::Search) ? o.klass : o },
19
19
  format: options.delete(:format)
20
20
  )
21
21
  else
22
22
  raise ArgumentError,
23
- 'No Ransack::Search object was provided to search_form_for!'
23
+ 'No Ransack::Search object was provided to search_form_for!'
24
24
  end
25
25
  options[:html] ||= {}
26
26
  html_options = {
@@ -1,3 +1,3 @@
1
1
  module Ransack
2
- VERSION = "1.6.1"
2
+ VERSION = "1.6.2"
3
3
  end
@@ -6,8 +6,10 @@ module Ransack
6
6
 
7
7
  router = ActionDispatch::Routing::RouteSet.new
8
8
  router.draw do
9
- resources :people
10
- resources :notes
9
+ resources :people, :notes
10
+ namespace :admin do
11
+ resources :comments
12
+ end
11
13
  get ':controller(/:action(/:id(.:format)))'
12
14
  end
13
15
 
@@ -372,6 +374,13 @@ module Ransack
372
374
  it { should match /action="\/people.json"/ }
373
375
  end
374
376
 
377
+ describe '#search_form_for with an array of routes' do
378
+ subject {
379
+ @controller.view_context.search_form_for([:admin, Comment.search]) {}
380
+ }
381
+ it { should match /action="\/admin\/comments"/ }
382
+ end
383
+
375
384
  describe '#search_form_for with custom default search key' do
376
385
  before do
377
386
  Ransack.configure { |c| c.search_key = :example }
@@ -39,17 +39,21 @@ class Person < ActiveRecord::Base
39
39
  scope :restricted, lambda { where("restricted = 1") }
40
40
  scope :active, lambda { where("active = 1") }
41
41
  scope :over_age, lambda { |y| where(["age > ?", y]) }
42
- scope :of_age, lambda { |of_age| of_age ? where("age >= ?", 18) : where("age < ?", 18) }
42
+ scope :of_age, lambda { |of_age|
43
+ of_age ? where("age >= ?", 18) : where("age < ?", 18)
44
+ }
43
45
 
44
46
  ransacker :reversed_name, :formatter => proc { |v| v.reverse } do |parent|
45
47
  parent.table[:name]
46
48
  end
47
49
 
48
- ransacker :array_users, formatter: proc { |v| Person.first(2).map(&:id) } do |parent|
50
+ ransacker :array_users,
51
+ formatter: proc { |v| Person.first(2).map(&:id) } do |parent|
49
52
  parent.table[:id]
50
53
  end
51
54
 
52
- ransacker :array_names, formatter: proc { |v| Person.first(2).map {|p| p.id.to_s } } do |parent|
55
+ ransacker :array_names,
56
+ formatter: proc { |v| Person.first(2).map { |p| p.id.to_s } } do |parent|
53
57
  parent.table[:name]
54
58
  end
55
59
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernie Miller