active_decorator 0.8.0 → 0.9.0

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: 14f002118bfbc2127bf674fc7488990d80a5152c
4
- data.tar.gz: 6e40b90bb6ffc7ba584147a93041025456216f52
3
+ metadata.gz: 4a64ac56dc2cc2bf285935260b3dd24f83df0b82
4
+ data.tar.gz: ec20d7d2ea5a11c8dff62b1b4bf648e73294da95
5
5
  SHA512:
6
- metadata.gz: 5bd8f1c1bdc0cfe4734755e9a56fd1d20cbea6205319ac20c308360b95b5c74303d3f16cda0002458c2b33795ad6690e2eb8401ed99d35db4c3068f5630e6936
7
- data.tar.gz: cf5c094dedd2637ea7f23bdd3b0f131b2a33f0cc98e9ff2148433960e8305c2b1732d7cf6005bd82247d9cc8b8a71897c61e5bcd5f9d044a641d970f53c7fa58
6
+ metadata.gz: 113084bbe2c85cfe885ba8c99bac86b7a09650647630fe4c5c71c93ef2c316039552055a5200d49fc1d2f87a0573686d8c6865f22e38761c46751fbdd23ea58b
7
+ data.tar.gz: a8dd5c74158c52d2dbda7116a3289ac30287b639606271f14f4ddcd924f6a2ee3dac79294fec6c9d3e41f6d55aea20f027530358589bf17f42e1a51a4fd7bb0a
@@ -1,12 +1,14 @@
1
1
  language: ruby
2
2
 
3
+ before_install: gem update bundler --no-document
3
4
  script: bundle exec rake test
4
5
 
5
6
  rvm:
6
7
  - 2.0.0
7
8
  - 2.1.10
8
- - 2.2.6
9
+ - 2.2.7
9
10
  - 2.3.3
11
+ - 2.4.1
10
12
  - ruby-head
11
13
  gemfile:
12
14
  - gemfiles/Gemfile-rails.3.2.x
@@ -14,6 +16,7 @@ gemfile:
14
16
  - gemfiles/Gemfile-rails.4.1.x
15
17
  - gemfiles/Gemfile-rails.4.2.x
16
18
  - gemfiles/Gemfile-rails.5.0.x
19
+ - gemfiles/Gemfile-rails.5.1.x
17
20
 
18
21
  sudo: false
19
22
 
@@ -25,9 +28,22 @@ matrix:
25
28
  gemfile: gemfiles/Gemfile-rails.4.0.x
26
29
  - rvm: ruby-head
27
30
  gemfile: gemfiles/Gemfile-rails.4.1.x
31
+ - rvm: 2.4.1
32
+ gemfile: gemfiles/Gemfile-rails.3.2.x
33
+ - rvm: 2.4.1
34
+ gemfile: gemfiles/Gemfile-rails.4.0.x
35
+ - rvm: 2.4.1
36
+ gemfile: gemfiles/Gemfile-rails.4.1.x
37
+ - rvm: 2.4.1
38
+ gemfile: gemfiles/Gemfile-rails.4.2.x
28
39
  - rvm: 2.0.0
29
40
  gemfile: gemfiles/Gemfile-rails.5.0.x
30
41
  - rvm: 2.1.10
31
42
  gemfile: gemfiles/Gemfile-rails.5.0.x
43
+ - rvm: 2.0.0
44
+ gemfile: gemfiles/Gemfile-rails.5.1.x
45
+ - rvm: 2.1.10
46
+ gemfile: gemfiles/Gemfile-rails.5.1.x
32
47
  allow_failures:
33
48
  - rvm: ruby-head
49
+ - gemfile: gemfiles/Gemfile-rails.5.1.x
data/README.md CHANGED
@@ -8,13 +8,14 @@ A simple and Rubyish view helper for Rails 3, Rails 4 and Rails 5. Keep your hel
8
8
  1. automatically mixes decorator module into corresponding model only when:
9
9
  1. passing a model or collection of models or an instance of ActiveRecord::Relation from controllers to views
10
10
  2. rendering partials with models (using `:collection` or `:object` or `:locals` explicitly or implicitly)
11
+ 3. fetching already decorated Active Record model object's association
11
12
  2. the decorator module runs in the model's context. So, you can directly call any attributes or methods in the decorator module
12
13
  3. since decorators are considered as sort of helpers, you can also call any ActionView's helper methods such as `content_tag` or `link_to`
13
14
 
14
15
 
15
16
  ## Supported versions ##
16
17
 
17
- * Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, and 2.4 (trunk)
18
+ * Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, and 2.5 (trunk)
18
19
 
19
20
  * Rails 3.2.x, 4.0.x, 4.1.x, 4.2.x, 5.0, and 5.1 (edge)
20
21
 
@@ -34,77 +35,81 @@ You can use the generator for doing this ( `% rails g decorator user` )
34
35
 
35
36
  ## Examples ##
36
37
 
38
+ ### Auto-decorating via `render` ###
39
+
40
+ * Model
37
41
  ```ruby
38
- # app/models/user.rb
39
- class User < ActiveRecord::Base
40
- # first_name:string last_name:string website:string
42
+ class Author < ActiveRecord::Base
43
+ # first_name:string last_name:string
41
44
  end
45
+ ```
42
46
 
43
- # app/decorators/user_decorator.rb
44
- module UserDecorator
45
- def full_name
46
- "#{first_name} #{last_name}"
47
- end
48
-
49
- def link
50
- link_to full_name, website
47
+ * Controller
48
+ ```ruby
49
+ class AuthorsController < ApplicationController
50
+ def show(id)
51
+ @user = Author.find id
51
52
  end
52
53
  end
54
+ ```
53
55
 
54
- # app/controllers/users_controller.rb
55
- class UsersController < ApplicationController
56
- def index
57
- @users = User.all
56
+ * Decorator
57
+ ```ruby
58
+ module AuthorDecorator
59
+ def full_name
60
+ "#{first_name} #{last_name}"
58
61
  end
59
62
  end
60
63
  ```
64
+
65
+ * View
61
66
  ```erb
62
- # app/views/users/index.html.erb
63
- <% @users.each do |user| %>
64
- <%= user.link %><br>
65
- <% end %>
67
+ <%# @author here is auto-decorated in between the controller and the view %>
68
+ <p><%= @author.full_name %></p>
66
69
  ```
67
70
 
68
- ## Decorating associated objects ##
69
-
70
- ActiveDecorator *does not* automatically decorate associated objects. We recommend that you pass associated objects to `render` when decorated associated objects are needed.
71
+ ### Auto-decorating via AR model's associated objects ###
71
72
 
73
+ * Models
72
74
  ```ruby
73
- # app/models/blog_post.rb
74
- class BlogPost < ActiveRecord::Base
75
- # published_at:datetime
75
+ class Author < ActiveRecord::Base
76
+ # name:string
77
+ has_many :books
76
78
  end
77
79
 
78
- # app/models/user.rb
79
- class User < ActiveRecord::Base
80
- has_many :blog_posts
80
+ class Book < ActiveRecord::Base
81
+ # title:string url:string
82
+ belongs_to :author
81
83
  end
84
+ ```
82
85
 
83
- # app/decorators/blog_post_decorator.rb
84
- module BlogPostDecorator
85
- def published_date
86
- published_at.strftime("%Y.%m.%d")
86
+ * Controller
87
+ ```ruby
88
+ class AuthorsController < ApplicationController
89
+ def show(id)
90
+ @user = Author.find id
87
91
  end
88
92
  end
93
+ ```
89
94
 
90
- # app/controllers/users_controller.rb
91
- class UsersController < ApplicationController
92
- def index
93
- @users = User.all
95
+ * Decorator
96
+ ```ruby
97
+ module BookDecorator
98
+ def link
99
+ link_to title, url
94
100
  end
95
101
  end
96
102
  ```
97
103
 
104
+ * View
98
105
  ```erb
99
- # app/views/users/index.html.erb
100
- <% @users.each do |user| %>
101
- <%= render partial: "blog_post", locals: { blog_posts: user.blog_posts } %><br>
102
- <% end %>
103
-
104
- # app/views/users/_blog_post.html.erb
105
- <% blog_posts.each do |blog_post| %>
106
- <%= blog_post.published_date %>
106
+ <p><%= @author.name %></p>
107
+ <ul>
108
+ <% @author.books.each do |book| %>
109
+ <%# `book` here is auto-decorated because @author is a decorated instance %>
110
+ <li><%= book.link %></li>
107
111
  <% end %>
112
+ </ul>
108
113
  ```
109
114
 
110
115
  ## Testing
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'active_decorator', path: '..'
4
+
5
+ gem 'rails', '5.1.0.rc1'
6
+ gem 'test-unit-rails'
7
+ gem 'capybara'
8
+ gem 'sqlite3'
9
+ gem 'jbuilder'
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ # A no-op module to mark an AR model instance as a "decorated" object.
3
+ module ActiveDecorator::Decorated
4
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'singleton'
3
3
  require 'active_decorator/helpers'
4
+ require 'active_decorator/decorated'
4
5
 
5
6
  module ActiveDecorator
6
7
  class Decorator
@@ -10,8 +11,17 @@ module ActiveDecorator
10
11
  @@decorators = {}
11
12
  end
12
13
 
14
+ # Decorates the given object.
15
+ # Plus, performs special decoration for the classes below:
16
+ # Array: decorates its each element
17
+ # AR::Relation: decorates its each record lazily
18
+ # AR model: decorates its associations on the fly
19
+ #
20
+ # Always returns the object, regardless of whether decorated or not decorated.
21
+ #
22
+ # This method can be publicly called from anywhere by `ActiveDecorator::Decorator.instance.decorate(obj)`.
13
23
  def decorate(obj)
14
- return if defined?(Jbuilder) && Jbuilder === obj
24
+ return if defined?(Jbuilder) && (Jbuilder === obj)
15
25
  return if obj.nil?
16
26
 
17
27
  if obj.is_a?(Array)
@@ -28,13 +38,26 @@ module ActiveDecorator
28
38
  obj.extend ActiveDecorator::RelationDecoratorLegacy unless obj.is_a? ActiveDecorator::RelationDecoratorLegacy
29
39
  end
30
40
  else
41
+ if defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Base) && !obj.is_a?(ActiveDecorator::Decorated)
42
+ obj.extend ActiveDecorator::Decorated
43
+ end
44
+
31
45
  d = decorator_for obj.class
32
46
  return obj unless d
33
47
  obj.extend d unless obj.is_a? d
48
+ obj
34
49
  end
35
50
  end
36
51
 
52
+ # Decorates AR model object's association only when the object was decorated.
53
+ # Returns the association instance.
54
+ def decorate_association(owner, target)
55
+ owner.is_a?(ActiveDecorator::Decorated) ? decorate(target) : target
56
+ end
57
+
37
58
  private
59
+ # Returns a decorator module for the given class.
60
+ # Returns `nil` if no decorator module was found.
38
61
  def decorator_for(model_class)
39
62
  return @@decorators[model_class] if @@decorators.key? model_class
40
63
 
@@ -57,6 +80,7 @@ module ActiveDecorator
57
80
  end
58
81
  end
59
82
 
83
+ # For AR 3 and 4
60
84
  module RelationDecoratorLegacy
61
85
  def to_a
62
86
  super.tap do |arr|
@@ -65,6 +89,7 @@ module ActiveDecorator
65
89
  end
66
90
  end
67
91
 
92
+ # For AR 5+
68
93
  module RelationDecorator
69
94
  def records
70
95
  super.tap do |arr|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # On the fly delegation from the decorator to the decorated object and the helpers.
2
3
  module ActiveDecorator
3
4
  module Helpers
4
5
  def method_missing(method, *args, &block)
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ # A monkey-patch for Rails controllers/mailers that auto-decorates ivars
3
+ # that are passed to views.
2
4
  module ActiveDecorator
3
5
  module Monkey
4
6
  module AbstractController
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ # A monkey-patch for Action Controller to pass the controller view_context over
3
+ # to `render` invocation in `rescue_from` block.
2
4
  module ActiveDecorator
3
5
  module Monkey
4
6
  module ActionController
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # A monkey-patch for Action View `render :partial` that auto-decorates `locals` values.
2
3
  module ActiveDecorator
3
4
  module Monkey
4
5
  module ActionView
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+ # A monkey-patch for Active Record that enables association auto-decoration.
3
+ module ActiveDecorator
4
+ module Monkey
5
+ module ActiveRecord
6
+ module Associations
7
+ module Association
8
+ def target
9
+ ActiveDecorator::Decorator.instance.decorate_association(owner, super)
10
+ end
11
+ end
12
+
13
+ # @see https://github.com/rails/rails/commit/03855e790de2224519f55382e3c32118be31eeff
14
+ if Rails.version.to_f < 4.1
15
+ module CollectionAssociation
16
+ private
17
+ def first_or_last(*)
18
+ ActiveDecorator::Decorator.instance.decorate_association(owner, super)
19
+ end
20
+ end
21
+ elsif Rails.version.to_f < 5.1
22
+ module CollectionAssociation
23
+ private
24
+ def first_nth_or_last(*)
25
+ ActiveDecorator::Decorator.instance.decorate_association(owner, super)
26
+ end
27
+ end
28
+ end
29
+
30
+ if Rails.version.to_f >= 4.0
31
+ module CollectionProxy
32
+ def take(limit = nil)
33
+ ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
34
+ end
35
+
36
+ if Rails.version.to_f >= 5.1
37
+ def last(limit = nil)
38
+ ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
39
+ end
40
+
41
+ private
42
+
43
+ def find_nth_with_limit(index, limit)
44
+ ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
45
+ end
46
+
47
+ def find_nth_from_last(index)
48
+ ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -28,6 +28,17 @@ module ActiveDecorator
28
28
  ActionMailer::Base.send :include, ActiveDecorator::ViewContext::Filter
29
29
  end
30
30
  end
31
+
32
+ ActiveSupport.on_load :active_record do
33
+ require 'active_decorator/monkey/active_record/associations'
34
+ ActiveRecord::Associations::Association.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::Association
35
+ if Rails.version.to_f < 5.1
36
+ ActiveRecord::Associations::CollectionAssociation.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::CollectionAssociation
37
+ end
38
+ if Rails.version.to_f >= 4.0
39
+ ActiveRecord::Associations::CollectionProxy.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::CollectionProxy
40
+ end
41
+ end
31
42
  end
32
43
  end
33
44
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveDecorator
3
- VERSION = '0.8.0'
3
+ VERSION = '0.9.0'
4
4
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # A module that carries the controllers' view_context to decorators.
2
3
  module ActiveDecorator
3
4
  module ViewContext
4
5
  class << self
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ describe ActiveDecorator::Decorator do
5
+ subject { ActiveDecorator::Decorator.instance }
6
+ let(:book) { Book.new(title: 'Boek') }
7
+
8
+ it 'returns the object on decoration' do
9
+ subject.decorate(book).should == book
10
+ end
11
+
12
+ it "returns the object when it already is decorated on decorate" do
13
+ subject.decorate(subject.decorate(book)).should == book
14
+ end
15
+ end
@@ -4,6 +4,10 @@ require 'test_helper'
4
4
  class MoviesControllerTest < ActionController::TestCase
5
5
  test 'reveals fakes' do
6
6
  movie = Movie.create
7
- assert_nothing_raised { get :show, id: movie.id }
7
+ if Rails::VERSION::MAJOR >= 5
8
+ assert_nothing_raised { get :show, params: {id: movie.id} }
9
+ else
10
+ assert_nothing_raised { get :show, id: movie.id }
11
+ end
8
12
  end
9
13
  end
@@ -1,2 +1,10 @@
1
1
  <%= @author.name %>
2
2
  <%= @author.capitalized_name %>
3
+ <%= @author.books.first.upcased_title %>
4
+ <%= @author.books.last.upcased_title %>
5
+ <% if Rails.version.to_f >= 4.0 && p = @author.publishers.take %><%= p.upcased_name %><% end %>
6
+ <% if Rails.version.to_f >= 5.1 && p = @author.publishers.second_to_last %><%= p.reversed_name %><% end %>
7
+ <% if p = @author.profile %><%= p.address %><% end %>
8
+ <% if h = @author.profile_history %><%= h.update_date %><% end %>
9
+ <% if m = @author.magazines.first %><%= m.upcased_title %><% end %>
10
+ <% if c = @author.company %><%= c.reverse_name %><% end %>
@@ -1 +1,2 @@
1
1
  <%= @movie.name %>
2
+ <% if a = @movie.author %><%= a.reverse_name %><% end %>
@@ -46,13 +46,39 @@ end
46
46
  # models
47
47
  class Author < ActiveRecord::Base
48
48
  has_many :books
49
+ has_many :publishers, through: :books
50
+ has_many :movies
51
+ has_one :profile
52
+ has_one :profile_history, through: :profile
53
+ has_and_belongs_to_many :magazines
54
+ belongs_to :company
49
55
  end
50
56
  class Book < ActiveRecord::Base
51
57
  belongs_to :author
58
+ belongs_to :publisher
59
+ accepts_nested_attributes_for :publisher
52
60
  end
53
61
  class Novel < Book
54
62
  end
55
63
  class Movie < ActiveRecord::Base
64
+ belongs_to :author
65
+ end
66
+ class Publisher < ActiveRecord::Base
67
+ has_many :books
68
+ end
69
+ class Profile < ActiveRecord::Base
70
+ belongs_to :author
71
+ has_one :profile_history
72
+ accepts_nested_attributes_for :profile_history
73
+ end
74
+ class ProfileHistory < ActiveRecord::Base
75
+ belongs_to :profile
76
+ end
77
+ class Magazine < ActiveRecord::Base
78
+ has_and_belongs_to_many :authors
79
+ end
80
+ class Company < ActiveRecord::Base
81
+ has_many :authors
56
82
  end
57
83
 
58
84
  # helpers
@@ -93,6 +119,35 @@ module BookDecorator
93
119
  "ERROR"
94
120
  end
95
121
  end
122
+ module PublisherDecorator
123
+ def upcased_name
124
+ name.upcase
125
+ end
126
+
127
+ def reversed_name
128
+ name.reverse
129
+ end
130
+ end
131
+ module ProfileDecorator
132
+ def address
133
+ "secret"
134
+ end
135
+ end
136
+ module ProfileHistoryDecorator
137
+ def update_date
138
+ updated_on.strftime('%Y/%m/%d')
139
+ end
140
+ end
141
+ module MagazineDecorator
142
+ def upcased_title
143
+ title.upcase
144
+ end
145
+ end
146
+ module CompanyDecorator
147
+ def reverse_name
148
+ name.reverse
149
+ end
150
+ end
96
151
 
97
152
  # decorator fake
98
153
  class MovieDecorator; end
@@ -176,11 +231,17 @@ class BookMailer < ActionMailer::Base
176
231
  end
177
232
 
178
233
  # migrations
179
- class CreateAllTables < ActiveRecord::Migration
234
+ class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
180
235
  def self.up
181
- create_table(:authors) {|t| t.string :name}
182
- create_table(:books) {|t| t.string :title; t.references :author; t.string :type }
183
- create_table(:movies) {|t| t.string :name}
236
+ create_table(:authors) {|t| t.string :name; t.references :company}
237
+ create_table(:books) {|t| t.string :title; t.string :type; t.references :author; t.references :publisher }
238
+ create_table(:profiles) {|t| t.string :address; t.references :author}
239
+ create_table(:profile_histories) {|t| t.date :updated_on; t.references :profile}
240
+ create_table(:publishers) {|t| t.string :name}
241
+ create_table(:movies) {|t| t.string :name; t.references :author}
242
+ create_table(:magazines) {|t| t.string :title}
243
+ create_table(:authors_magazines) {|t| t.references :author; t.references :magazine}
244
+ create_table(:companies) {|t| t.string :name}
184
245
  end
185
246
  end
186
247
 
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ require 'test_helper'
3
+
4
+ class AssociationTest < ActionDispatch::IntegrationTest
5
+ setup do
6
+ company = Company.create! name: 'NaCl'
7
+ @matz = company.authors.create! name: 'matz'
8
+ @matz.books.create!(
9
+ title: 'the world of code',
10
+ publisher_attributes: { name: 'nikkei linux' }
11
+ )
12
+ @matz.books.create!(
13
+ title: 'the ruby programming language',
14
+ publisher_attributes: { name: "o'reilly" }
15
+ )
16
+ @matz.create_profile! address: 'Matsue city, Shimane'
17
+ @matz.profile.create_profile_history! updated_on: Date.new(2017, 2, 7)
18
+ @matz.magazines.create! title: 'rubima'
19
+ end
20
+
21
+ test 'decorating associated objects' do
22
+ visit "/authors/#{@matz.id}"
23
+ assert page.has_content? 'the world of code'.upcase
24
+ assert page.has_content? 'the ruby programming language'.upcase
25
+ if Rails.version.to_f >= 4.0
26
+ assert page.has_content? 'nikkei linux'.upcase
27
+ end
28
+ if Rails.version.to_f >= 5.1
29
+ assert page.has_content? 'nikkei linux'.reverse
30
+ end
31
+ assert page.has_content? 'secret'
32
+ assert page.has_content? '2017/02/07'
33
+ assert page.has_content? 'rubima'.upcase
34
+ assert page.has_content? 'NaCl'.reverse
35
+ end
36
+
37
+ test "decorating associated objects that owner doesn't have decorator" do
38
+ movie = Movie.create! author: @matz
39
+ visit "/movies/#{movie.id}"
40
+ assert page.has_content? 'matz'.reverse
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple and Rubyish view helper for Rails
14
14
  email:
@@ -29,13 +29,16 @@ files:
29
29
  - gemfiles/Gemfile-rails.4.1.x
30
30
  - gemfiles/Gemfile-rails.4.2.x
31
31
  - gemfiles/Gemfile-rails.5.0.x
32
+ - gemfiles/Gemfile-rails.5.1.x
32
33
  - lib/active_decorator.rb
33
34
  - lib/active_decorator/config.rb
35
+ - lib/active_decorator/decorated.rb
34
36
  - lib/active_decorator/decorator.rb
35
37
  - lib/active_decorator/helpers.rb
36
38
  - lib/active_decorator/monkey/abstract_controller/rendering.rb
37
39
  - lib/active_decorator/monkey/action_controller/base/rescue_from.rb
38
40
  - lib/active_decorator/monkey/action_view/partial_renderer.rb
41
+ - lib/active_decorator/monkey/active_record/associations.rb
39
42
  - lib/active_decorator/railtie.rb
40
43
  - lib/active_decorator/version.rb
41
44
  - lib/active_decorator/view_context.rb
@@ -45,6 +48,7 @@ files:
45
48
  - lib/generators/rspec/templates/decorator_spec.rb
46
49
  - lib/generators/test_unit/decorator_generator.rb
47
50
  - lib/generators/test_unit/templates/decorator_test.rb
51
+ - spec/lib/decorator_spec.rb
48
52
  - test/configuration_test.rb
49
53
  - test/controllers/fake_detection_test.rb
50
54
  - test/fake_app/app/views/authors/index.html.erb
@@ -62,6 +66,7 @@ files:
62
66
  - test/fake_app/app/views/movies/show.html.erb
63
67
  - test/fake_app/fake_app.rb
64
68
  - test/features/action_view_helpers_test.rb
69
+ - test/features/association_test.rb
65
70
  - test/features/controller_ivar_test.rb
66
71
  - test/features/jbuilder_test.rb
67
72
  - test/features/name_error_handling_test.rb
@@ -86,11 +91,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
91
  version: '0'
87
92
  requirements: []
88
93
  rubyforge_project:
89
- rubygems_version: 2.6.8
94
+ rubygems_version: 2.6.11
90
95
  signing_key:
91
96
  specification_version: 4
92
97
  summary: A simple and Rubyish view helper for Rails
93
98
  test_files:
99
+ - spec/lib/decorator_spec.rb
94
100
  - test/configuration_test.rb
95
101
  - test/controllers/fake_detection_test.rb
96
102
  - test/fake_app/app/views/authors/index.html.erb
@@ -108,6 +114,7 @@ test_files:
108
114
  - test/fake_app/app/views/movies/show.html.erb
109
115
  - test/fake_app/fake_app.rb
110
116
  - test/features/action_view_helpers_test.rb
117
+ - test/features/association_test.rb
111
118
  - test/features/controller_ivar_test.rb
112
119
  - test/features/jbuilder_test.rb
113
120
  - test/features/name_error_handling_test.rb