draper 3.0.0 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +55 -0
  3. data/CHANGELOG.md +46 -0
  4. data/Gemfile +11 -2
  5. data/README.md +43 -5
  6. data/bin/bundle +114 -0
  7. data/bin/rake +29 -0
  8. data/draper.gemspec +9 -8
  9. data/lib/draper.rb +3 -0
  10. data/lib/draper/automatic_delegation.rb +4 -2
  11. data/lib/draper/collection_decorator.rb +4 -2
  12. data/lib/draper/compatibility/global_id.rb +22 -0
  13. data/lib/draper/configuration.rb +8 -0
  14. data/lib/draper/decoratable.rb +6 -7
  15. data/lib/draper/decorated_association.rb +0 -2
  16. data/lib/draper/decorator.rb +19 -13
  17. data/lib/draper/delegation.rb +1 -1
  18. data/lib/draper/finders.rb +0 -1
  19. data/lib/draper/helper_proxy.rb +2 -2
  20. data/lib/draper/lazy_helpers.rb +1 -3
  21. data/lib/draper/query_methods.rb +23 -0
  22. data/lib/draper/query_methods/load_strategy.rb +21 -0
  23. data/lib/draper/test_case.rb +3 -3
  24. data/lib/draper/undecorate.rb +1 -1
  25. data/lib/draper/version.rb +1 -1
  26. data/lib/draper/view_context/build_strategy.rb +1 -3
  27. data/lib/draper/view_helpers.rb +5 -5
  28. data/lib/generators/draper/install_generator.rb +1 -1
  29. data/lib/generators/mini_test/decorator_generator.rb +1 -1
  30. data/lib/generators/rails/decorator_generator.rb +1 -1
  31. data/lib/generators/rspec/decorator_generator.rb +6 -4
  32. data/lib/generators/test_unit/decorator_generator.rb +7 -4
  33. data/spec/draper/collection_decorator_spec.rb +5 -6
  34. data/spec/draper/configuration_spec.rb +32 -8
  35. data/spec/draper/decoratable_spec.rb +24 -4
  36. data/spec/draper/decorated_association_spec.rb +0 -2
  37. data/spec/draper/decorator_spec.rb +36 -3
  38. data/spec/draper/draper_spec.rb +1 -0
  39. data/spec/draper/factory_spec.rb +0 -4
  40. data/spec/draper/query_methods/load_strategy_spec.rb +26 -0
  41. data/spec/draper/query_methods_spec.rb +70 -0
  42. data/spec/dummy/app/assets/config/manifest.js +3 -0
  43. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  44. data/spec/dummy/app/jobs/publish_post_job.rb +7 -0
  45. data/spec/dummy/app/models/application_record.rb +3 -0
  46. data/spec/dummy/app/models/post.rb +1 -1
  47. data/spec/dummy/config/application.rb +0 -3
  48. data/spec/dummy/config/environments/development.rb +2 -0
  49. data/spec/dummy/config/environments/production.rb +2 -0
  50. data/spec/dummy/config/environments/test.rb +4 -0
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/spec/dummy/config/storage.yml +7 -0
  53. data/spec/dummy/db/migrate/20121019115657_create_posts.rb +1 -1
  54. data/spec/dummy/spec/jobs/publish_post_job_spec.rb +9 -0
  55. data/spec/dummy/spec/models/application_spec.rb +7 -0
  56. data/spec/dummy/spec/models/post_spec.rb +11 -2
  57. data/spec/generators/controller/controller_generator_spec.rb +1 -0
  58. data/spec/generators/decorator/decorator_generator_spec.rb +1 -1
  59. data/spec/integration/integration_spec.rb +1 -0
  60. data/spec/spec_helper.rb +9 -0
  61. metadata +72 -20
  62. data/.travis.yml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6f2c896cc71e7e4e654a5d65907dd0ec4cefed7f
4
- data.tar.gz: ce50051cf161e9416483a40797d38ae2d2da3384
2
+ SHA256:
3
+ metadata.gz: 6b009279cf28737a6fcf4027fc26f3dc2a955741c7c5e5d2220c8dcb383490e3
4
+ data.tar.gz: 22455a3a7126650483af269d6a0e432a5a4465a59c762518ce78f40bcecb4286
5
5
  SHA512:
6
- metadata.gz: 527adb1c71ce28f23bb9be4186fe857c543a26edd8d20404f1e2a6db51e819143dd9c7973f7735746457c2a8a392e7a6d5b8a79232d26a1694035e09441a98f4
7
- data.tar.gz: 0ed34d19d3b0300ea733392aab2c4cceaa1b284efc71e84452331fea4c9c11c68c7dc00baa7802a864d60f69bfb42beb8f5cecf959ed5ebf01b8a24c7e676f3f
6
+ metadata.gz: 2fd6c0b87227c23320e9ee211b4b2001c81cbf76d103a12e5076f427954febdb2d0366d5182f16b27f5155717ad878f08671098f8b1f9986c137ec053e1637bf
7
+ data.tar.gz: 260d4eccd57c623c966422cd256ab1485e1ce4bbaea05d2c6f615cdb644ab0147f00e8917b8165eba78651f279b66cde0a13da38b1c5cc9dc6a0e49822db2361
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: CI
3
+
4
+ on:
5
+ - push
6
+ - pull_request
7
+
8
+ jobs:
9
+ rspec:
10
+ runs-on: ubuntu-20.04
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby:
15
+ - '3.0'
16
+ - '2.7'
17
+ - '2.6'
18
+ - '2.5'
19
+ - '2.4'
20
+
21
+ services:
22
+ mongodb:
23
+ image: mongo
24
+ ports:
25
+ - 27017:27017
26
+
27
+ steps:
28
+ - name: Checkout
29
+ uses: actions/checkout@v2
30
+
31
+ - name: Setup Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+
36
+ - name: Setup Ruby cache
37
+ uses: actions/cache@v2
38
+ with:
39
+ path: vendor/bundle
40
+ key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
41
+ restore-keys: |
42
+ ${{ runner.os }}-gems-${{ matrix.ruby }}-
43
+
44
+ - name: Bundle
45
+ run: |
46
+ gem install bundler
47
+ bundle config path vendor/bundle
48
+ bundle install --jobs 4 --retry 3
49
+
50
+ - name: RSpec & publish code coverage
51
+ uses: paambaati/codeclimate-action@v2.7.5
52
+ env:
53
+ CC_TEST_REPORTER_ID: b7ba588af2a540fa96c267b3655a2afe31ea29976dc25905a668dd28d5e88915
54
+ with:
55
+ coverageCommand: bin/rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Draper Changelog
2
2
 
3
+ ## 4.0.2 - 2021-05-27
4
+
5
+ ### Fixes
6
+ * Fix kwargs usage for Ruby 3 compatibility [#885](https://github.com/drapergem/draper/pull/885)
7
+ * Fix ruby warnings for "ambiguous first argument" [#881](https://github.com/drapergem/draper/pull/881)
8
+ * Fix rake warnings in CI [#897](https://github.com/drapergem/draper/pull/897)
9
+ * Fix decoration spec [#895](https://github.com/drapergem/draper/pull/895)
10
+
11
+ ### Other Changes
12
+ * Migration from Travis CI to GitHub Actions [#893](https://github.com/drapergem/draper/pull/893), [#896](https://github.com/drapergem/draper/pull/896), [#903](https://github.com/drapergem/draper/pull/903)
13
+
14
+ ## 4.0.1 - 2020-03-25
15
+
16
+ ### Fixes
17
+ * Check only object's private methods when preventing delegation [#875](https://github.com/drapergem/draper/pull/875)
18
+
19
+ ### Other Changes
20
+ * Use `alias` over `alias_method` [#877](https://github.com/drapergem/draper/pull/877)
21
+
22
+ ## 4.0.0 - 2020-02-05
23
+
24
+ ### Breaking Changes
25
+ * Drop support for Ruby < 2.4 [#852](https://github.com/drapergem/draper/pull/852), [#872](https://github.com/drapergem/draper/pull/872)
26
+ * Don't delegate public methods overridden by a private method in the decorator [#849](https://github.com/drapergem/draper/pull/849)
27
+
28
+ ### Fixes
29
+ * Add preservation of decorator options on QueryMethods [#868](https://github.com/drapergem/draper/pull/868)
30
+ * Add `#respond_to_missing?` to `CollectionDecorator` so it correctly responds to ORM methods [#850](https://github.com/drapergem/draper/pull/850)
31
+ * Fix deprecation warning with the new Rails 6 `ActionView::Base` constructor [#866](https://github.com/drapergem/draper/pull/866)
32
+ * Fix deprecation warning with Ruby 2.7 [#870](https://github.com/drapergem/draper/pull/870)
33
+
34
+ ### Other Changes
35
+ * Add SimpleCov for code coverage analysis [#851](https://github.com/drapergem/draper/pull/851)
36
+ * Update RSpec syntax in the README [#855](https://github.com/drapergem/draper/pull/855)
37
+ * Update continuous integration configuration [#861](https://github.com/drapergem/draper/pull/861), [#862](https://github.com/drapergem/draper/pull/862), [#863](https://github.com/drapergem/draper/pull/863), [#872](https://github.com/drapergem/draper/pull/872)
38
+
39
+ ## 3.1.0
40
+ * Rails 6 support [#841](https://github.com/drapergem/draper/pull/841)
41
+ * Include ORM query methods in `CollectionDecorator` (e.g. `includes`) [#845](https://github.com/drapergem/draper/pull/845)
42
+ * Document the fix for view context leaking in specs [#847](https://github.com/drapergem/draper/pull/847)
43
+
44
+ ## 3.0.1
45
+ * Let `decorator_class` infer anonymous class decorator from superclass [#820](https://github.com/drapergem/draper/pull/820)
46
+ * When inferring decorator fails, show original class instead of `ActiveRecord::Base` [#821](https://github.com/drapergem/draper/pull/821)
47
+ * ActiveJob compatibility and documentation [#817](https://github.com/drapergem/draper/pull/817)
48
+
3
49
  ## 3.0.0 - 2017
4
50
 
5
51
  ### Breaking Changes
data/Gemfile CHANGED
@@ -3,7 +3,11 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  platforms :ruby do
6
- gem "sqlite3"
6
+ if RUBY_VERSION >= "2.5.0"
7
+ gem 'sqlite3'
8
+ else
9
+ gem 'sqlite3', '~> 1.3.6'
10
+ end
7
11
  end
8
12
 
9
13
  platforms :jruby do
@@ -11,5 +15,10 @@ platforms :jruby do
11
15
  gem "activerecord-jdbcsqlite3-adapter"
12
16
  end
13
17
 
14
- gem "rails", "~> 5.0"
18
+ if RUBY_VERSION >= "2.5.0"
19
+ gem "rails", "~> 6.0"
20
+ gem 'webrick'
21
+ else
22
+ gem "rails", "~> 5.0"
23
+ end
15
24
  gem "mongoid", github: "mongodb/mongoid"
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Draper: View Models for Rails
2
2
 
3
- [![TravisCI Build Status](https://travis-ci.org/drapergem/draper.svg?branch=master)](http://travis-ci.org/drapergem/draper)
3
+ [![Actions Status](https://github.com/drapergem/draper/workflows/CI/badge.svg?branch=master)](https://github.com/drapergem/draper/actions?query=workflow%3Aci+branch%3Amaster)
4
4
  [![Code Climate](https://codeclimate.com/github/drapergem/draper.svg)](https://codeclimate.com/github/drapergem/draper)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/0d40c43951d516bf6985/test_coverage)](https://codeclimate.com/github/drapergem/draper/test_coverage)
5
6
  [![Inline docs](http://inch-ci.org/github/drapergem/draper.svg?branch=master)](http://inch-ci.org/github/drapergem/draper)
6
7
 
7
8
  Draper adds an object-oriented layer of presentation logic to your Rails
@@ -107,7 +108,7 @@ Decorators are the ideal place to:
107
108
 
108
109
  ## Installation
109
110
 
110
- As of version 3.0.0, Draper is only compatible with Rails 5 / Ruby 2.2 and later. Add Draper to your Gemfile.
111
+ As of version 4.0.0, Draper only officially supports Rails 5.2 / Ruby 2.4 and later. Add Draper to your Gemfile.
111
112
 
112
113
  ```ruby
113
114
  gem 'draper'
@@ -326,6 +327,17 @@ your `ArticleDecorator` and they'll return decorated objects:
326
327
  @article = ArticleDecorator.find(params[:id])
327
328
  ```
328
329
 
330
+ ### Decorated Query Methods
331
+ By default, Draper will decorate all [QueryMethods](https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html)
332
+ of ActiveRecord.
333
+ If you're using another ORM, in order to support it, you can tell Draper to use a custom strategy:
334
+
335
+ ```ruby
336
+ Draper.configure do |config|
337
+ config.default_query_methods_strategy = :mongoid
338
+ end
339
+ ```
340
+
329
341
  ### When to Decorate Objects
330
342
 
331
343
  Decorators are supposed to behave very much like the models they decorate, and
@@ -368,7 +380,7 @@ can continue to use the `@article` instance variable to manipulate the model -
368
380
  for example, `@article.comments.build` to add a new blank comment for a form.
369
381
 
370
382
  ## Configuration
371
- Draper works out the box well, but also provides a hook for you to configure its
383
+ Draper works out the box well, but also provides a hook for you to configure its
372
384
  default functionality. For example, Draper assumes you have a base `ApplicationController`.
373
385
  If your base controller is named something different (e.g. `BaseController`),
374
386
  you can tell Draper to use it by adding the following to an initializer:
@@ -457,12 +469,29 @@ end
457
469
  ```
458
470
 
459
471
  Then you can stub the specific route helper functions you need using your
460
- preferred stubbing technique (this example uses RSpec's `stub` method):
472
+ preferred stubbing technique. This examples uses Rspec currently recommended API
473
+ available in RSpec 3.6+
474
+
475
+ ```ruby
476
+ without_partial_double_verification do
477
+ allow(helpers).to receive(:users_path).and_return('/users')
478
+ end
479
+ ```
480
+
481
+ ### View context leakage
482
+ As mentioned before, Draper needs to build a view context to access helper methods. In MiniTest, the view context is
483
+ cleared during `before_setup` preventing any view context leakage. In RSpec, the view context is cleared before each
484
+ `decorator`, `controller`, and `mailer` spec. However, if you use decorators in other types of specs
485
+ (e.g. `job`), you may still experience the view context leaking from the previous spec. To solve this, add the
486
+ following to your `spec_helper` for each type of spec you are experiencing the leakage:
461
487
 
462
488
  ```ruby
463
- helpers.stub(users_path: '/users')
489
+ config.before(:each, type: :type) { Draper::ViewContext.clear! }
464
490
  ```
465
491
 
492
+ _Note_: The `:type` above is just a placeholder. Replace `:type` with the type of spec you are experiencing
493
+ the leakage from.
494
+
466
495
  ## Advanced usage
467
496
 
468
497
  ### Shared Decorator Methods
@@ -618,6 +647,15 @@ is included in `ActiveRecord::Base` and `Mongoid::Document` by default. If
618
647
  you're using another ORM, or want to decorate plain old Ruby objects,
619
648
  you can include this module manually.
620
649
 
650
+ ### Active Job Integration
651
+
652
+ [Active Job](http://edgeguides.rubyonrails.org/active_job_basics.html) allows you to pass ActiveRecord
653
+ objects to background tasks directly and performs the necessary serialization and deserialization. In
654
+ order to do this, arguments to a background job must implement [Global ID](https://github.com/rails/globalid).
655
+ Decorated objects implement Global ID by delegating to the object they are decorating. This means
656
+ you can pass decorated objects to background jobs, however, the object won't be decorated when it is
657
+ deserialized.
658
+
621
659
  ## Contributors
622
660
 
623
661
  Draper was conceived by Jeff Casimir and heavily refined by Steve Klabnik and a
data/bin/bundle ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/draper.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(__dir__, "lib", "draper", "version")
1
+ require_relative 'lib/draper/version'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "draper"
@@ -12,22 +12,23 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
15
  s.require_paths = ["lib"]
17
16
 
18
17
  s.required_ruby_version = '>= 2.2.2'
19
18
 
20
- s.add_dependency 'activesupport', '~> 5.0'
21
- s.add_dependency 'actionpack', '~> 5.0'
22
- s.add_dependency 'request_store', '~> 1.0'
23
- s.add_dependency 'activemodel', '~> 5.0'
24
- s.add_dependency 'activemodel-serializers-xml', '~> 1.0'
19
+ s.add_dependency 'activesupport', '>= 5.0'
20
+ s.add_dependency 'actionpack', '>= 5.0'
21
+ s.add_dependency 'request_store', '>= 1.0'
22
+ s.add_dependency 'activemodel', '>= 5.0'
23
+ s.add_dependency 'activemodel-serializers-xml', '>= 1.0'
24
+ s.add_dependency 'ruby2_keywords'
25
25
 
26
26
  s.add_development_dependency 'ammeter'
27
27
  s.add_development_dependency 'rake'
28
28
  s.add_development_dependency 'rspec-rails'
29
29
  s.add_development_dependency 'minitest-rails'
30
30
  s.add_development_dependency 'capybara'
31
- s.add_development_dependency 'active_model_serializers', '~> 0.10'
31
+ s.add_development_dependency 'active_model_serializers', '>= 0.10'
32
32
  s.add_development_dependency 'rubocop'
33
+ s.add_development_dependency 'simplecov', '0.17.1'
33
34
  end
data/lib/draper.rb CHANGED
@@ -8,6 +8,8 @@ require 'active_support/core_ext/hash/keys'
8
8
  require 'active_support/core_ext/hash/reverse_merge'
9
9
  require 'active_support/core_ext/name_error'
10
10
 
11
+ require 'ruby2_keywords'
12
+
11
13
  require 'draper/version'
12
14
  require 'draper/configuration'
13
15
  require 'draper/view_helpers'
@@ -23,6 +25,7 @@ require 'draper/factory'
23
25
  require 'draper/decorated_association'
24
26
  require 'draper/helper_support'
25
27
  require 'draper/view_context'
28
+ require 'draper/query_methods'
26
29
  require 'draper/collection_decorator'
27
30
  require 'draper/undecorate'
28
31
  require 'draper/decorates_assigned'
@@ -6,7 +6,7 @@ module Draper
6
6
  # method calls to `object` as well. Calling `super` will first try to call the method on
7
7
  # the parent decorator class. If no method exists on the parent class, it will then try
8
8
  # to call the method on the `object`.
9
- def method_missing(method, *args, &block)
9
+ ruby2_keywords def method_missing(method, *args, &block)
10
10
  return super unless delegatable?(method)
11
11
 
12
12
  object.send(method, *args, &block)
@@ -20,12 +20,14 @@ module Draper
20
20
 
21
21
  # @private
22
22
  def delegatable?(method)
23
+ return if private_methods(false).include?(method)
24
+
23
25
  object.respond_to?(method)
24
26
  end
25
27
 
26
28
  module ClassMethods
27
29
  # Proxies missing class methods to the source class.
28
- def method_missing(method, *args, &block)
30
+ ruby2_keywords def method_missing(method, *args, &block)
29
31
  return super unless delegatable?(method)
30
32
 
31
33
  object_class.send(method, *args, &block)