README.md in tramway-0.3.1.2 vs README.md in tramway-0.3.2
- old
+ new
@@ -79,20 +79,34 @@
render TableComponent.new(object.posts)
end
end
```
-#### Decorate single object
+#### Decorate a single object
You can use the same method to decorate a single object either
```ruby
def show
@user = tramway_decorate User.find params[:id]
end
```
+#### Decorate a collection of objects
+
+```ruby
+def index
+ @users = tramway_decorate User.all
+end
+```
+
+```ruby
+def index
+ @posts = tramway_decorate user.posts
+end
+```
+
#### Decorate with a specific decorator
You can implement a specific decorator and ask Tramway to decorate with it
```ruby
@@ -332,19 +346,21 @@
```ruby
= tramway_form_for User.new do |f|
= f.text_field :text
= f.password_field :password
+ = f.select :role, [:admin, :user]
= f.file_field :file
= f.submit "Create User"
```
will render [this](https://play.tailwindcss.com/xho3LfjKkK)
Available form helpers:
* text_field
* password_field
* file_field
+* select
* submit
## Contributing
Install [lefthook](https://github.com/evilmartians/lefthook)