Skip to content

Commit 2efc1c6

Browse files
committed
Use Phlex Rails adapters instead of helpers
1 parent 3319ab3 commit 2efc1c6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/superform/rails.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "phlex/rails"
2+
13
module Superform
24
module Rails
35
# The `ApplicationComponent` is the superclass for all components in your application.
@@ -14,6 +16,9 @@ module Rails
1416
# The `Form` component also handles Rails authenticity tokens via the `authenticity_toklen_field`
1517
# method and the HTTP verb via the `_method_field`.
1618
class Form < Component
19+
include Phlex::Rails::Helpers::FormAuthenticityToken
20+
include Phlex::Rails::Helpers::URLFor
21+
1722
attr_accessor :model
1823

1924
delegate \
@@ -115,7 +120,7 @@ def authenticity_token_field
115120
input(
116121
name: "authenticity_token",
117122
type: "hidden",
118-
value: helpers.form_authenticity_token
123+
value: form_authenticity_token
119124
)
120125
end
121126

@@ -144,7 +149,7 @@ def resource_action
144149
end
145150

146151
def form_action
147-
@action ||= helpers.url_for(action: resource_action)
152+
@action ||= url_for(action: resource_action)
148153
end
149154

150155
def form_method

0 commit comments

Comments
 (0)