Skip to content

Commit 320d89d

Browse files
committed
removed usage of Rails.application.routes.url_helpers as it's not longer required
1 parent 61f0aa2 commit 320d89d

File tree

1 file changed

+2
-3
lines changed
  • docs/ui_components/100-rails_integration

1 file changed

+2
-3
lines changed

docs/ui_components/100-rails_integration/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ The easiest way to integrate Matestack is by creating custom components and usin
1414

1515
This is a perfect place to start refactoring our application to use matestack. It's easy to start from the inside out, first replacing parts of your UI with components. As partials already are used to structure your UI in smaller reusable parts they are a perfect starting point. So let's refactor our product teaser into a custom component.
1616

17-
After successfully following the [installation guide](/docs/start/100-installation/README.md) we can start. Remember to set the id "matestack-ui" in your corresponding layout.
17+
After successfully following the [installation guide](/docs/start/100-installation/README.md) we can start.
1818

1919
Start by creating a file called `teaser.rb` in `app/matestack/components/products/teaser.rb`. Placement of this file is as you see similar to our partial. In this file we implement our component in pure ruby as follows:
2020

2121
```ruby
2222
class Components::Products::Teaser < Matestack::Ui::Component
23-
include ::Rails.application.routes.url_helpers
2423

2524
requires :product
2625

@@ -37,7 +36,7 @@ class Components::Products::Teaser < Matestack::Ui::Component
3736
end
3837
```
3938

40-
We inherit from `Matestack::Ui::Component` to create our teaser component. As it should display product informations it requires a product. We can access this product through a getter method `product`. To access Rails url helpers we have to include `Rails.application.routes.url_helpers` as components usually get access to them through the pages but we render our component outside a Matestack page. Now we have now a teaser component, but in order to use it we have to register it and include our registration in our `ApplicationController`.
39+
We inherit from `Matestack::Ui::Component` to create our teaser component. As it should display product informations it requires a product. We can access this product through a getter method `product`. Now we have now a teaser component, but in order to use it we have to register it and include our registration in our `ApplicationController`.
4140

4241
Let's register our component by creating a component registry in `app/matestack/components/registry.rb`.
4342

0 commit comments

Comments
 (0)