ransack 1.6.5 → 1.6.6

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: ab38816eaa6fefc0b47ab0814d69ddf4f9dfbbf8
4
- data.tar.gz: ed98ed6e4ede9c729fb05cc4ddfb00d646a79149
3
+ metadata.gz: 3d0f75469674a840fd6677c3e2cea940c84e4438
4
+ data.tar.gz: 6ab05dd928c897263c629de60c06dfb10fc74ea5
5
5
  SHA512:
6
- metadata.gz: 837ce300a188d1e7cf59eff19548d4dc1b1c817276249d83326b9b776b8ba3ae49072ebf1850e3437a54d70a1fafbf3473165856d88afdbb5f139d505ea4309d
7
- data.tar.gz: d1cbcb0ec2d6876511b4624a93c9a85f3d5500705305faf8dc566e54c16c3d5572b5838882723d9ee3fc6df696dd5b3ccfe8dfbb73ed47008f782d42983e496c
6
+ metadata.gz: a46b017f203b3581ba2349417891e6f3733f3a49aa2c843daa748d69fd1b9a6f7f0daf0ec7ad72ae56e6f8b724b3c886447fdc532f2a79254b2651353d148ed0
7
+ data.tar.gz: a835c33713bcc0dd9269c12e1dbe80f20a922ca8ceaf2e5ce3955b360f80c4a42a478d0e72de9d7df9bc2f0b34f29853eb6fb75c919a64ecfdad9eb41d678612
@@ -1,5 +1,43 @@
1
1
  # Change Log
2
2
 
3
+ ## Version 1.6.6 - 2015-04-05
4
+ ### Changed
5
+
6
+ * Upgrade Polyamorous dependency to version 1.2.0, which uses Module#prepend instead of monkey-patching for hooking into Active Record (with Ruby 2.x).
7
+
8
+ *Jon Atack*
9
+
10
+ ### Fixed
11
+
12
+ * An improved fix for the "undefined method `model_name` for Ransack::Search"
13
+ issue [#518](https://github.com/activerecord-hackery/ransack/issues/518)
14
+ affecting Rails 4.2.1 and 5.0.0. This fix allows us to remove the
15
+ ActionView patch in Ransack version 1.6.4.
16
+
17
+ *Gleb Mazovetskiy*
18
+
19
+ * Fix an erroneous reference in `ActiveRecord::Associations::JoinDependency`
20
+ to a version-dependent Active Record reference, and replace it with a
21
+ better, more reliable one defined in Polyamorous. As this class lives
22
+ inside an `ActiveRecord` module, the reference needs to be absolute in
23
+ order to properly point to the AR class.
24
+
25
+ *Nahuel Cuesta Luengo*
26
+
27
+ * Fix RubyGems YARD rendering of the README docs.
28
+
29
+ *Jon Atack*
30
+
31
+ ### Added
32
+
33
+ * Add the Ruby version to the the header message that shows the database,
34
+ Active Record and Arel versions when running tests.
35
+
36
+ * Add Code Climate analysis.
37
+
38
+ *Jon Atack*
39
+
40
+
3
41
  ## Version 1.6.5 - 2015-03-28 - Rails 5.0.0 update
4
42
  ### Added
5
43
 
data/Gemfile CHANGED
@@ -7,10 +7,11 @@ rails = ENV['RAILS'] || '4-2-stable'
7
7
 
8
8
  if rails == 'master'
9
9
  gem 'arel', github: 'rails/arel'
10
+ gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
11
+ else
12
+ gem 'polyamorous', '~> 1.2'
10
13
  end
11
14
 
12
- gem 'polyamorous', '~> 1.1'
13
-
14
15
  gem 'pry'
15
16
 
16
17
  # Provide timezone information on Windows
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  (https://travis-ci.org/activerecord-hackery/ransack)
5
5
  [![Gem Version](https://badge.fury.io/rb/ransack.svg)]
6
6
  (http://badge.fury.io/rb/ransack)
7
+ [![Code Climate](https://codeclimate.com/github/activerecord-hackery/ransack/badges/gpa.svg)]
8
+ (https://codeclimate.com/github/activerecord-hackery/ransack)
7
9
 
8
10
  Ransack is a rewrite of [MetaSearch]
9
11
  (https://github.com/activerecord-hackery/meta_search)
@@ -27,20 +29,20 @@ instead.
27
29
  If you're viewing this at
28
30
  [github.com/activerecord-hackery/ransack](https://github.com/activerecord-hackery/ransack),
29
31
  you're reading the documentation for the master branch with the latest features.
30
- [View documentation for the last release (1.6.5).]
31
- (https://github.com/activerecord-hackery/ransack/tree/v1.6.5)
32
+ [View documentation for the last release (1.6.6).]
33
+ (https://github.com/activerecord-hackery/ransack/tree/v1.6.6)
32
34
 
33
35
  ## Getting started
34
36
 
35
37
  Ransack is compatible with Rails 3 and 4 (including 4.2.1) on Ruby 1.9 and
36
- later. It currently works with Rails 5 as well, though changes in Arel and
37
- Active Record keep that a moving target. If you are using Ruby 1.8, you can use
38
- an earlier version of Ransack up to v1.3.0.
38
+ later (Ruby 2.2 recommended). Ransack currently works with Rails master (5.0.0)
39
+ too! If you are using Ruby 1.8, you can use an earlier version of Ransack up to
40
+ 1.3.0.
39
41
 
40
42
  Ransack works out-of-the-box with Active Record and also features experimental
41
43
  support for Mongoid 4.0 (without associations, further details below).
42
44
 
43
- In your Gemfile, for the last officially released Ransack gem:
45
+ In your Gemfile, for the last officially released gem:
44
46
 
45
47
  ```ruby
46
48
  gem 'ransack'
@@ -120,7 +122,7 @@ The two primary Ransack view helpers are `search_form_for` and `sort_link`,
120
122
  which are defined in
121
123
  [Ransack::Helpers::FormHelper](lib/ransack/helpers/form_helper.rb).
122
124
 
123
- #####Ransack's `search_form_for` helper replaces `form_for` for creating the view search form:
125
+ ####Ransack's `search_form_for` helper replaces `form_for` for creating the view search form
124
126
 
125
127
  ```erb
126
128
  <%= search_form_for @q do |f| %>
@@ -142,20 +144,21 @@ which are defined in
142
144
  ```
143
145
 
144
146
  `cont` (contains) and `start` (starts with) are just two of the available
145
- search predicates. See [Constants]
146
- (https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/constants.rb)
147
- for a full list and the [wiki]
148
- (https://github.com/activerecord-hackery/ransack/wiki/Basic-Searching)
147
+ search predicates. See
148
+ [Constants](https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/constants.rb)
149
+ for a full list and the
150
+ [wiki](https://github.com/activerecord-hackery/ransack/wiki/Basic-Searching)
149
151
  for more information.
150
152
 
151
153
  The `search_form_for` answer format can be set like this:
154
+
152
155
  ```erb
153
156
  <%= search_form_for(@q, format: :pdf) do |f| %>
154
157
 
155
158
  <%= search_form_for(@q, format: :json) do |f| %>
156
159
  ```
157
160
 
158
- #####Ransack's `sort_link` helper creates table headers that are sortable links:
161
+ ####Ransack's `sort_link` helper creates table headers that are sortable links
159
162
 
160
163
  ```erb
161
164
  <%= sort_link(@q, :name) %>
@@ -681,4 +684,4 @@ fix bugs!
681
684
 
682
685
  ## Copyright
683
686
 
684
- Copyright &copy; 2011-2014 [Ernie Miller](http://twitter.com/erniemiller)
687
+ Copyright &copy; 2011-2015 [Ernie Miller](http://twitter.com/erniemiller)
@@ -184,7 +184,7 @@ module Ransack
184
184
  :string_join
185
185
  when Hash, Symbol, Array
186
186
  :association_join
187
- when ActiveRecord::Associations::JoinDependency
187
+ when Polyamorous::JoinDependency, Polyamorous::JoinAssociation
188
188
  :stashed_join
189
189
  when Arel::Nodes::Join
190
190
  :join_node
@@ -1,36 +1,15 @@
1
1
  require 'action_view'
2
2
 
3
- # Monkey-patching, avert your eyes!
4
- # TODO: Find a better way to solve these two issues:
5
- #
6
3
  module ActionView::Helpers::Tags
7
-
4
+ # TODO: Find a better way to solve this issue!
8
5
  # This patch is needed since this Rails commit:
9
6
  # https://github.com/rails/rails/commit/c1a118a
10
- #
11
7
  class Base
12
8
  private
13
9
  def value(object)
14
10
  object.send @method_name if object # use send instead of public_send
15
11
  end
16
12
  end
17
-
18
- # This patch is needed for Rails 4.2.1 and 5.0.0 since these commits:
19
- #
20
- # Rails 4.2:
21
- # https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_view/helpers/tags/translator.rb
22
- # https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_view/helpers/tags/placeholderable.rb
23
- #
24
- # Rails master:
25
- # https://github.com/rails/rails/commits/master/actionview/lib/action_view/helpers/tags/translator.rb
26
- # https://github.com/rails/rails/commits/master/actionview/lib/action_view/helpers/tags/placeholderable.rb
27
- #
28
- class Translator
29
- def i18n_default
30
- return '' unless model
31
- ["#{model}.#{method_and_value}".to_sym, ""]
32
- end
33
- end
34
13
  end
35
14
 
36
15
  RANSACK_FORM_BUILDER = 'RANSACK_FORM_BUILDER'.freeze
@@ -20,6 +20,10 @@ module Ransack
20
20
  def to_model
21
21
  self
22
22
  end
23
+
24
+ def model_name
25
+ self.class.model_name
26
+ end
23
27
  end
24
28
 
25
29
  class Name < String
@@ -1,3 +1,3 @@
1
1
  module Ransack
2
- VERSION = "1.6.5"
2
+ VERSION = '1.6.6'
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'activerecord', '>= 3.0'
21
21
  s.add_dependency 'activesupport', '>= 3.0'
22
22
  s.add_dependency 'i18n'
23
- s.add_dependency 'polyamorous', '~> 1.1'
23
+ s.add_dependency 'polyamorous', '~> 1.2'
24
24
  s.add_development_dependency 'rspec', '~> 2.14.0'
25
25
  s.add_development_dependency 'machinist', '~> 1.0.6'
26
26
  s.add_development_dependency 'faker', '~> 0.9.5'
@@ -28,10 +28,12 @@ RSpec.configure do |config|
28
28
  config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior'
29
29
 
30
30
  config.before(:suite) do
31
- connection_name = ActiveRecord::Base.connection.adapter_name
32
- message = "Running specs against #{connection_name}, Active Record #{
33
- ActiveRecord::VERSION::STRING} and Arel #{Arel::VERSION}..."
34
- puts '=' * message.length, message, '=' * message.length
31
+ message = "Running Ransack specs with #{
32
+ ActiveRecord::Base.connection.adapter_name
33
+ }, Active Record #{::ActiveRecord::VERSION::STRING}, Arel #{Arel::VERSION
34
+ } and Ruby #{RUBY_VERSION}"
35
+ line = '=' * message.length
36
+ puts line, message, line
35
37
  Schema.create
36
38
  end
37
39
 
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.5
4
+ version: 1.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernie Miller
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-28 00:00:00.000000000 Z
13
+ date: 2015-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack
@@ -74,14 +74,14 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '1.1'
77
+ version: '1.2'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '1.1'
84
+ version: '1.2'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec
87
87
  requirement: !ruby/object:Gem::Requirement