Skip to content

Commit 540330d

Browse files
authored
Remove misleading documentation
1 parent ae06d97 commit 540330d

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

docs/components/form.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,18 @@ Show [specs](../../spec/usage/components/form_spec.rb)
88

99
These examples show generic use cases and can be used as a guideline of what is possible with the form core component.
1010

11-
Beforehand, we define open routes for the form input in our `config/routes.rb`:
11+
Beforehand, we define some example routes for the form input in our `config/routes.rb`:
1212

1313
```ruby
1414
post '/success_form_test/:id', to: 'form_test#success_submit', as: 'success_form_test'
1515
post '/failure_form_test/:id', to: 'form_test#failure_submit', as: 'failure_form_test'
1616
post '/model_form_test', to: 'model_form_test#model_submit', as: 'model_form_test'
1717
```
1818

19-
We also configure our controllers to accept form input and react in a predictable and verbose way:
19+
We also configure our example controllers to accept form input and react in a predictable and verbose way:
2020

2121
```ruby
22-
class TestController < ActionController::Base
23-
24-
before_action :check_params
25-
26-
def check_params
27-
expect_params(params.permit!.to_h)
28-
end
29-
30-
def expect_params(params)
31-
end
32-
33-
end
34-
```
35-
36-
```ruby
37-
class FormTestController < TestController
22+
class FormTestController < ApplicationController
3823

3924
def success_submit
4025
render json: { message: 'server says: form submitted successfully' }, status: 200
@@ -51,7 +36,7 @@ end
5136
```
5237

5338
```ruby
54-
class ModelFormTestController < TestController
39+
class ModelFormTestController < ApplicationController
5540

5641
def model_submit
5742
@test_model = TestModel.create(model_params)
@@ -110,7 +95,7 @@ end
11095

11196
When we visit `localhost:3000/example`, fill in the input field with *bar* and click the submit button, our `FormTestController` receives the input.
11297

113-
Furthermore, our *bar* input disappears from the input field and we get displayed our nice little succes message of `server says: form submitted successfully` - Easy!
98+
Furthermore, our *bar* input disappears from the input field - Easy!
11499

115100
### Example 2: Async submit request with failure event
116101

@@ -157,7 +142,7 @@ Now, when we visit our example page on `localhost:3000/example` and fill in the
157142

158143
In this example, things get a bit more complex. We now want to transition to another page of our application after successfully submitting a form!
159144

160-
First, we define our application layout with messages, using the *async core component*:
145+
In order to additionally show a success/failure message, we define our matestack app layout with messages, using the *async core component*:
161146

162147
```ruby
163148
class Apps::ExampleApp < Matestack::Ui::App

0 commit comments

Comments
 (0)