lib/hanami/cli/generators/app/relation.rb in hanami-cli-2.2.0.rc1 vs lib/hanami/cli/generators/app/relation.rb in hanami-cli-2.2.0
- old
+ new
@@ -17,22 +17,25 @@
@out = out
end
# @since 2.2.0
# @api private
- def call(key:, namespace:, base_path:)
+ def call(key:, namespace:, base_path:, gateway:)
schema_name = key.split(KEY_SEPARATOR).last
+ body_content = ["schema :#{schema_name}, infer: true"]
+ body_content.prepend("gateway :#{gateway}") if gateway
+
RubyFileWriter.new(
fs: fs,
inflector: inflector,
).call(
namespace: namespace,
key: key,
base_path: base_path,
extra_namespace: "Relations",
relative_parent_class: "DB::Relation",
- body: ["schema :#{schema_name}, infer: true"],
+ body: body_content,
)
end
private