tapioca 0.4.10 → 0.4.15

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
  SHA256:
3
- metadata.gz: db90e001ad45dbd8edd11b2288405dd406588e1bb46120c7cd5f0cb560647ea6
4
- data.tar.gz: 1eab20c32a1785046f814ca2fc54866bbc0c9d083bf682a8b1ea15bf92c9cc1e
3
+ metadata.gz: 41fd25f2497122191c01ef7e9376d6d56e070e9ec5e7626fd1ace153a1b01fd5
4
+ data.tar.gz: 390bdd0023f086be720f722d530c00cee4eafd603052259331a353c4fa0d3a9b
5
5
  SHA512:
6
- metadata.gz: 77d4598557fc72b8a76dea56b626d05a3f91dd88d53cb0e96156ed92419534a32beeed17cd0f4791e37c972f2da86c07bb6a386a0dbb5813a5b4f998438e3127
7
- data.tar.gz: 102c5591a319f1846506d0e1e439f52613bc9f5d6110eab98ee857d7a943921584e12b56733ec7b4f6e95824396ea1052ffc691eed0505bf2b00a7438ceabbe0
6
+ metadata.gz: 1f25290fb6e4544329b79b7eb20191126cddf1e9707f1aeb98b60d1dd24ea1f9c7df525ccfb5fd2b50fb12929b773b9adf9143b98da859903c29cdf3125484f6
7
+ data.tar.gz: 8c7adbe3d3881118487945b46638d5b0bdd29d732424f071c7efb39048db80c7cdd9601bc51e306742aaeae02b002661204e5c18eeb8162c138507269a794c01
data/Gemfile CHANGED
@@ -10,12 +10,10 @@ group(:deployment, :development) do
10
10
  gem("rake")
11
11
  end
12
12
 
13
- gem("bundler", "~> 1.17")
14
13
  gem("yard", "~> 0.9.25")
15
14
  gem("pry-byebug")
16
15
  gem("minitest")
17
16
  gem("minitest-hooks")
18
- gem("minitest-fork_executor")
19
17
  gem("minitest-reporters")
20
18
  gem("sorbet")
21
19
 
@@ -33,6 +31,9 @@ group(:development, :test) do
33
31
  gem("activemodel-serializers-xml", "~> 1.0", require: false)
34
32
  gem("activeresource", "~> 5.1", require: false)
35
33
  gem("google-protobuf", "~>3.12.0", require: false)
34
+ # Fix version to 0.14.1 since it is the last version to support Ruby 2.4
35
+ gem("shopify-money", "= 0.14.1", require: false)
36
+ gem("sidekiq", "~>5.0", require: false) # Version 6 dropped support for Ruby 2.4
36
37
  end
37
38
 
38
39
  gem "rubocop-sorbet", ">= 0.4.1"
@@ -13,8 +13,7 @@ module Tapioca
13
13
  module Compilers
14
14
  module Dsl
15
15
  # `Tapioca::Compilers::Dsl::ActionControllerHelpers` decorates RBI files for all
16
- # subclasses of `::ActionController::Base`
17
- # to add helper methods (see https://api.rubyonrails.org/classes/ActionController/Helpers.html).
16
+ # subclasses of [`ActionController::Base`](https://api.rubyonrails.org/classes/ActionController/Helpers.html).
18
17
  #
19
18
  # For example, with the following `MyHelper` module:
20
19
  #
@@ -50,22 +49,22 @@ module Tapioca
50
49
  # # user_controller.rbi
51
50
  # # typed: strong
52
51
  # class UserController
53
- # sig { returns(UserController::HelperProxy) }
54
- # def helpers; end
55
- # end
52
+ # module HelperMethods
53
+ # include MyHelper
56
54
  #
57
- # module UserController::HelperMethods
58
- # include MyHelper
55
+ # sig { params(user: T.untyped).returns(T.untyped) }
56
+ # def age(user); end
59
57
  #
60
- # sig { params(user: T.untyped).returns(T.untyped) }
61
- # def age(user); end
58
+ # sig { returns(T.untyped) }
59
+ # def current_user_name; end
60
+ # end
62
61
  #
63
- # sig { returns(T.untyped) }
64
- # def current_user_name; end
65
- # end
62
+ # class HelperProxy < ::ActionView::Base
63
+ # include HelperMethods
64
+ # end
66
65
  #
67
- # class UserController::HelperProxy < ::ActionView::Base
68
- # include UserController::HelperMethods
66
+ # sig { returns(HelperProxy) }
67
+ # def helpers; end
69
68
  # end
70
69
  # ~~~
71
70
  class ActionControllerHelpers < Base
@@ -77,42 +76,42 @@ module Tapioca
77
76
  .void
78
77
  end
79
78
  def decorate(root, constant)
80
- helper_proxy_name = "#{constant}::HelperProxy"
81
- helper_methods_name = "#{constant}::HelperMethods"
79
+ helper_proxy_name = "HelperProxy"
80
+ helper_methods_name = "HelperMethods"
82
81
  proxied_helper_methods = constant._helper_methods.map(&:to_s).map(&:to_sym)
83
82
 
84
- # Create helper method module
85
- root.create_module(helper_methods_name) do |helper_methods|
86
- helpers_module = constant._helpers
83
+ # Define the helpers method
84
+ root.path(constant) do |controller|
85
+ create_method(controller, 'helpers', return_type: helper_proxy_name)
87
86
 
88
- gather_includes(helpers_module).each do |ancestor|
89
- helper_methods.create_include(ancestor)
90
- end
87
+ # Create helper method module
88
+ controller.create_module(helper_methods_name) do |helper_methods|
89
+ helpers_module = constant._helpers
91
90
 
92
- helpers_module.instance_methods(false).each do |method_name|
93
- method = if proxied_helper_methods.include?(method_name)
94
- constant.instance_method(method_name)
95
- else
96
- helpers_module.instance_method(method_name)
91
+ gather_includes(helpers_module).each do |ancestor|
92
+ helper_methods.create_include(ancestor)
97
93
  end
98
- create_method_from_def(helper_methods, method)
99
- end
100
- end
101
94
 
102
- # Create helper proxy class
103
- root.create_class(helper_proxy_name, superclass: "::ActionView::Base") do |proxy|
104
- proxy.create_include(helper_methods_name)
105
- end
95
+ helpers_module.instance_methods(false).each do |method_name|
96
+ method = if proxied_helper_methods.include?(method_name)
97
+ constant.instance_method(method_name)
98
+ else
99
+ helpers_module.instance_method(method_name)
100
+ end
101
+ create_method_from_def(helper_methods, method)
102
+ end
103
+ end
106
104
 
107
- # Define the helpers method
108
- root.path(constant) do |controller|
109
- create_method(controller, 'helpers', return_type: helper_proxy_name)
105
+ # Create helper proxy class
106
+ controller.create_class(helper_proxy_name, superclass: "::ActionView::Base") do |proxy|
107
+ proxy.create_include(helper_methods_name)
108
+ end
110
109
  end
111
110
  end
112
111
 
113
112
  sig { override.returns(T::Enumerable[Module]) }
114
113
  def gather_constants
115
- ::ActionController::Base.descendants.reject(&:abstract?)
114
+ ::ActionController::Base.descendants.reject(&:abstract?).select(&:name)
116
115
  end
117
116
 
118
117
  private
@@ -121,7 +120,7 @@ module Tapioca
121
120
  def gather_includes(mod)
122
121
  mod.ancestors
123
122
  .reject { |ancestor| ancestor.is_a?(Class) || ancestor == mod || ancestor.name.nil? }
124
- .map { |ancestor| T.must(ancestor.name) }
123
+ .map { |ancestor| "::#{ancestor.name}" }
125
124
  .reverse
126
125
  end
127
126
  end
@@ -12,8 +12,8 @@ end
12
12
  module Tapioca
13
13
  module Compilers
14
14
  module Dsl
15
- # `Tapioca::Compilers::Dsl::ActionMailer` generates RBI files for subclasses of `ActionMailer::Base`
16
- # (see https://api.rubyonrails.org/classes/ActionMailer/Base.html).
15
+ # `Tapioca::Compilers::Dsl::ActionMailer` generates RBI files for subclasses of
16
+ # [`ActionMailer::Base`](https://api.rubyonrails.org/classes/ActionMailer/Base.html).
17
17
  #
18
18
  # For example, with the following `ActionMailer` subclass:
19
19
  #
@@ -40,12 +40,12 @@ module Tapioca
40
40
 
41
41
  sig { override.params(root: Parlour::RbiGenerator::Namespace, constant: T.class_of(::ActionMailer::Base)).void }
42
42
  def decorate(root, constant)
43
- root.path(constant) do |k|
43
+ root.path(constant) do |mailer|
44
44
  constant.action_methods.to_a.each do |mailer_method|
45
45
  method_def = constant.instance_method(mailer_method)
46
46
  parameters = compile_method_parameters_to_parlour(method_def)
47
47
  create_method(
48
- k,
48
+ mailer,
49
49
  mailer_method,
50
50
  parameters: parameters,
51
51
  return_type: '::ActionMailer::MessageDelivery',
@@ -12,9 +12,9 @@ end
12
12
  module Tapioca
13
13
  module Compilers
14
14
  module Dsl
15
- # `Tapioca::Compilers::Dsl::ActiveRecordAssociations` refines RBI files for subclasses of `ActiveRecord::Base`
16
- # (see https://api.rubyonrails.org/classes/ActiveRecord/Base.html). This generator is only
17
- # responsible for defining the methods that would be created for the association that
15
+ # `Tapioca::Compilers::Dsl::ActiveRecordAssociations` refines RBI files for subclasses of
16
+ # [`ActiveRecord::Base`](https://api.rubyonrails.org/classes/ActiveRecord/Base.html).
17
+ # This generator is only responsible for defining the methods that would be created for the associations that
18
18
  # are defined in the Active Record model.
19
19
  #
20
20
  # For example, with the following model class:
@@ -24,6 +24,8 @@ module Tapioca
24
24
  # belongs_to :category
25
25
  # has_many :comments
26
26
  # has_one :author, class_name: "User"
27
+ #
28
+ # accepts_nested_attributes_for :category, :comments, :author
27
29
  # end
28
30
  # ~~~
29
31
  #
@@ -36,56 +38,65 @@ module Tapioca
36
38
  #
37
39
  # class Post
38
40
  # include Post::GeneratedAssociationMethods
39
- # end
40
41
  #
41
- # module Post::GeneratedAssociationMethods
42
- # sig { returns(T.nilable(::User)) }
43
- # def author; end
42
+ # module Post::GeneratedAssociationMethods
43
+ # sig { returns(T.nilable(::User)) }
44
+ # def author; end
45
+ #
46
+ # sig { params(value: T.nilable(::User)).void }
47
+ # def author=(value); end
48
+ #
49
+ # sig { params(attributes: T.untyped).returns(T.untyped) }
50
+ # def author_attributes=(attributes); end
51
+ #
52
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
53
+ # def build_author(*args, &blk); end
44
54
  #
45
- # sig { params(value: T.nilable(::User)).void }
46
- # def author=(value); end
55
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
56
+ # def build_category(*args, &blk); end
47
57
  #
48
- # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
49
- # def build_author(*args, &blk); end
58
+ # sig { returns(T.nilable(::Category)) }
59
+ # def category; end
50
60
  #
51
- # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
52
- # def build_category(*args, &blk); end
61
+ # sig { params(value: T.nilable(::Category)).void }
62
+ # def category=(value); end
53
63
  #
54
- # sig { returns(T.nilable(::Category)) }
55
- # def category; end
64
+ # sig { params(attributes: T.untyped).returns(T.untyped) }
65
+ # def category_attributes=(attributes); end
56
66
  #
57
- # sig { params(value: T.nilable(::Category)).void }
58
- # def category=(value); end
67
+ # sig { returns(T::Array[T.untyped]) }
68
+ # def comment_ids; end
59
69
  #
60
- # sig { returns(T::Array[T.untyped]) }
61
- # def comment_ids; end
70
+ # sig { params(ids: T::Array[T.untyped]).returns(T::Array[T.untyped]) }
71
+ # def comment_ids=(ids); end
62
72
  #
63
- # sig { params(ids: T::Array[T.untyped]).returns(T::Array[T.untyped]) }
64
- # def comment_ids=(ids); end
73
+ # sig { returns(::ActiveRecord::Associations::CollectionProxy[Comment]) }
74
+ # def comments; end
65
75
  #
66
- # sig { returns(::ActiveRecord::Associations::CollectionProxy[Comment]) }
67
- # def comments; end
76
+ # sig { params(value: T::Enumerable[::Comment]).void }
77
+ # def comments=(value); end
68
78
  #
69
- # sig { params(value: T::Enumerable[::Comment]).void }
70
- # def comments=(value); end
79
+ # sig { params(attributes: T.untyped).returns(T.untyped) }
80
+ # def comments_attributes=(attributes); end
71
81
  #
72
- # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
73
- # def create_author(*args, &blk); end
82
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
83
+ # def create_author(*args, &blk); end
74
84
  #
75
- # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
76
- # def create_author!(*args, &blk); end
85
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::User) }
86
+ # def create_author!(*args, &blk); end
77
87
  #
78
- # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
79
- # def create_category(*args, &blk); end
88
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
89
+ # def create_category(*args, &blk); end
80
90
  #
81
- # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
82
- # def create_category!(*args, &blk); end
91
+ # sig { params(args: T.untyped, blk: T.untyped).returns(::Category) }
92
+ # def create_category!(*args, &blk); end
83
93
  #
84
- # sig { returns(T.nilable(::User)) }
85
- # def reload_author; end
94
+ # sig { returns(T.nilable(::User)) }
95
+ # def reload_author; end
86
96
  #
87
- # sig { returns(T.nilable(::Category)) }
88
- # def reload_category; end
97
+ # sig { returns(T.nilable(::Category)) }
98
+ # def reload_category; end
99
+ # end
89
100
  # end
90
101
  # ~~~
91
102
  class ActiveRecordAssociations < Base
@@ -99,19 +110,15 @@ module Tapioca
99
110
  def decorate(root, constant)
100
111
  return if constant.reflections.empty?
101
112
 
102
- module_name = "#{constant}::GeneratedAssociationMethods"
103
- root.create_module(module_name) do |mod|
104
- constant.reflections.each do |association_name, reflection|
105
- if reflection.collection?
106
- populate_collection_assoc_getter_setter(mod, constant, association_name, reflection)
107
- else
108
- populate_single_assoc_getter_setter(mod, constant, association_name, reflection)
109
- end
113
+ root.path(constant) do |model|
114
+ module_name = "GeneratedAssociationMethods"
115
+
116
+ model.create_module(module_name) do |mod|
117
+ populate_nested_attribute_writers(mod, constant)
118
+ populate_associations(mod, constant)
110
119
  end
111
- end
112
120
 
113
- root.path(constant) do |klass|
114
- klass.create_include(module_name)
121
+ model.create_include(module_name)
115
122
  end
116
123
  end
117
124
 
@@ -122,6 +129,31 @@ module Tapioca
122
129
 
123
130
  private
124
131
 
132
+ sig { params(mod: Parlour::RbiGenerator::Namespace, constant: T.class_of(ActiveRecord::Base)).void }
133
+ def populate_nested_attribute_writers(mod, constant)
134
+ constant.nested_attributes_options.keys.each do |association_name|
135
+ create_method(
136
+ mod,
137
+ "#{association_name}_attributes=",
138
+ parameters: [
139
+ Parlour::RbiGenerator::Parameter.new("attributes", type: "T.untyped"),
140
+ ],
141
+ return_type: "T.untyped"
142
+ )
143
+ end
144
+ end
145
+
146
+ sig { params(mod: Parlour::RbiGenerator::Namespace, constant: T.class_of(ActiveRecord::Base)).void }
147
+ def populate_associations(mod, constant)
148
+ constant.reflections.each do |association_name, reflection|
149
+ if reflection.collection?
150
+ populate_collection_assoc_getter_setter(mod, constant, association_name, reflection)
151
+ else
152
+ populate_single_assoc_getter_setter(mod, constant, association_name, reflection)
153
+ end
154
+ end
155
+ end
156
+
125
157
  sig do
126
158
  params(
127
159
  klass: Parlour::RbiGenerator::Namespace,
@@ -12,24 +12,12 @@ end
12
12
  module Tapioca
13
13
  module Compilers
14
14
  module Dsl
15
- # `Tapioca::Compilers::Dsl::ActiveRecordColumns` refines RBI files for subclasses of `ActiveRecord::Base`
16
- # (see https://api.rubyonrails.org/classes/ActiveRecord/Base.html). This generator is only
17
- # responsible for defining the attribute methods that would be created for the columns that
18
- # are defined in the Active Record model.
19
- #
20
- # **Note:** This generator, by default, generates weak signatures for column methods and treats each
21
- # column to be `T.untyped`. This is done on purpose to ensure that the nilability of Active Record
22
- # columns do not make it hard for existing code to adopt gradual typing. It is possible, however, to
23
- # generate stricter type signatures for your ActiveRecord column types. If your ActiveRecord model extends
24
- # a module with name `StrongTypeGeneration`, this generator will generate stricter signatures that follow
25
- # closely with the types defined in the schema.
26
- #
27
- # The `StrongTypeGeneration` module you define in your application should add an `after_initialize` callback
28
- # to the model and ensure that all the non-nilable attributes of the model are actually initialized with non-`nil`
29
- # values.
15
+ # `Tapioca::Compilers::Dsl::ActiveRecordColumns` refines RBI files for subclasses of
16
+ # [`ActiveRecord::Base`](https://api.rubyonrails.org/classes/ActiveRecord/Base.html).
17
+ # This generator is only responsible for defining the attribute methods that would be
18
+ # created for the columns that are defined in the Active Record model.
30
19
  #
31
20
  # For example, with the following model class:
32
- #
33
21
  # ~~~rb
34
22
  # class Post < ActiveRecord::Base
35
23
  # end
@@ -54,54 +42,58 @@ module Tapioca
54
42
  # # post.rbi
55
43
  # # typed: true
56
44
  # class Post
57
- # sig { returns(T.nilable(::String)) }
58
- # def body; end
45
+ # include GeneratedAttributeMethods
46
+ #
47
+ # module GeneratedAttributeMethods
48
+ # sig { returns(T.nilable(::String)) }
49
+ # def body; end
59
50
  #
60
- # sig { params(value: T.nilable(::String)).returns(T.nilable(::String)) }
61
- # def body=; end
51
+ # sig { params(value: T.nilable(::String)).returns(T.nilable(::String)) }
52
+ # def body=; end
62
53
  #
63
- # sig { params(args: T.untyped).returns(T::Boolean) }
64
- # def body?; end
54
+ # sig { returns(T::Boolean) }
55
+ # def body?; end
65
56
  #
66
- # sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
67
- # def created_at; end
57
+ # sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
58
+ # def created_at; end
68
59
  #
69
- # sig { params(value: ::ActiveSupport::TimeWithZone).returns(::ActiveSupport::TimeWithZone) }
70
- # def created_at=; end
60
+ # sig { params(value: ::ActiveSupport::TimeWithZone).returns(::ActiveSupport::TimeWithZone) }
61
+ # def created_at=; end
71
62
  #
72
- # sig { params(args: T.untyped).returns(T::Boolean) }
73
- # def created_at?; end
63
+ # sig { returns(T::Boolean) }
64
+ # def created_at?; end
74
65
  #
75
- # sig { returns(T.nilable(T::Boolean)) }
76
- # def published; end
66
+ # sig { returns(T.nilable(T::Boolean)) }
67
+ # def published; end
77
68
  #
78
- # sig { params(value: T::Boolean).returns(T::Boolean) }
79
- # def published=; end
69
+ # sig { params(value: T::Boolean).returns(T::Boolean) }
70
+ # def published=; end
80
71
  #
81
- # sig { params(args: T.untyped).returns(T::Boolean) }
82
- # def published?; end
72
+ # sig { returns(T::Boolean) }
73
+ # def published?; end
83
74
  #
84
- # sig { returns(::String) }
85
- # def title; end
75
+ # sig { returns(::String) }
76
+ # def title; end
86
77
  #
87
- # sig { params(value: ::String).returns(::String) }
88
- # def title=(value); end
78
+ # sig { params(value: ::String).returns(::String) }
79
+ # def title=(value); end
89
80
  #
90
- # sig { params(args: T.untyped).returns(T::Boolean) }
91
- # def title?(*args); end
81
+ # sig { returns(T::Boolean) }
82
+ # def title?; end
92
83
  #
93
- # sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
94
- # def updated_at; end
84
+ # sig { returns(T.nilable(::ActiveSupport::TimeWithZone)) }
85
+ # def updated_at; end
95
86
  #
96
- # sig { params(value: ::ActiveSupport::TimeWithZone).returns(::ActiveSupport::TimeWithZone) }
97
- # def updated_at=; end
87
+ # sig { params(value: ::ActiveSupport::TimeWithZone).returns(::ActiveSupport::TimeWithZone) }
88
+ # def updated_at=; end
98
89
  #
99
- # sig { params(args: T.untyped).returns(T::Boolean) }
100
- # def updated_at?; end
90
+ # sig { returns(T::Boolean) }
91
+ # def updated_at?; end
101
92
  #
102
- # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html
103
- # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveModel/Dirty.html
104
- # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/BeforeTypeCast.html
93
+ # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html
94
+ # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveModel/Dirty.html
95
+ # ## Also the methods added by https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/BeforeTypeCast.html
96
+ # end
105
97
  # end
106
98
  # ~~~
107
99
  class ActiveRecordColumns < Base
@@ -111,26 +103,27 @@ module Tapioca
111
103
  def decorate(root, constant)
112
104
  return unless constant.table_exists?
113
105
 
114
- module_name = "#{constant}::GeneratedAttributeMethods"
115
- root.create_module(module_name) do |mod|
116
- constant.columns_hash.each_key do |column_name|
117
- column_name = column_name.to_s
118
- add_methods_for_attribute(mod, constant, column_name)
119
- end
106
+ root.path(constant) do |model|
107
+ module_name = "GeneratedAttributeMethods"
108
+
109
+ model.create_module(module_name) do |mod|
110
+ constant.columns_hash.each_key do |column_name|
111
+ column_name = column_name.to_s
112
+ add_methods_for_attribute(mod, constant, column_name)
113
+ end
120
114
 
121
- constant.attribute_aliases.each do |attribute_name, column_name|
122
- attribute_name = attribute_name.to_s
123
- column_name = column_name.to_s
124
- new_method_names = constant.attribute_method_matchers.map { |m| m.method_name(attribute_name) }
125
- old_method_names = constant.attribute_method_matchers.map { |m| m.method_name(column_name) }
126
- methods_to_add = new_method_names - old_method_names
115
+ constant.attribute_aliases.each do |attribute_name, column_name|
116
+ attribute_name = attribute_name.to_s
117
+ column_name = column_name.to_s
118
+ new_method_names = constant.attribute_method_matchers.map { |m| m.method_name(attribute_name) }
119
+ old_method_names = constant.attribute_method_matchers.map { |m| m.method_name(column_name) }
120
+ methods_to_add = new_method_names - old_method_names
127
121
 
128
- add_methods_for_attribute(mod, constant, column_name, attribute_name, methods_to_add)
122
+ add_methods_for_attribute(mod, constant, column_name, attribute_name, methods_to_add)
123
+ end
129
124
  end
130
- end
131
125
 
132
- root.path(constant) do |klass|
133
- klass.create_include(module_name)
126
+ model.create_include(module_name)
134
127
  end
135
128
  end
136
129
 
@@ -318,6 +311,8 @@ module Tapioca
318
311
 
319
312
  getter_type =
320
313
  case column_type
314
+ when defined?(MoneyColumn) && MoneyColumn::ActiveRecordType
315
+ "::Money"
321
316
  when ActiveRecord::Type::Integer
322
317
  "::Integer"
323
318
  when ActiveRecord::Type::String