You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-27Lines changed: 38 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,39 @@
1
-
# Restomatic
1
+
# RESTomatic
2
2
3
-
Better route mappers for Rails applications. Restomatic provides cleaner, more intuitive helpers for defining RESTful routes with proper scoping and namespacing.
3
+
RESTomatic helps Rails developers organize nested resources with automatic namespacing. Each nested resource gets its own controller module, making your app cleaner and easier to maintain.
4
+
5
+
Unlike Rails shallow routes that send everything to one controller, RESTomatic enforces proper separation: `Blogs::PostsController`, `Users::PostsController`, etc. keeping your controllers organized and your codebase more maintainable.
4
6
5
7
## Installation
6
8
7
9
Add to your Rails application Gemfile:
8
10
9
11
```ruby
10
-
gem"restomatic"
12
+
bundle add"restomatic"
11
13
```
14
+
That's it! The routing helpers are automatically available in your `config/routes.rb` file.
12
15
13
-
Then run:
16
+
Then start using more RESTful routes in `config/routes.rb`:
14
17
15
-
```bash
16
-
bundle install
17
-
```
18
+
```ruby
19
+
resources :blogsdo
20
+
nest :postsdo# Blogs::PostsController
21
+
collection do
22
+
get :search# Blogs::PostsController#search
23
+
end
24
+
end
25
+
end
18
26
19
-
That's it! The routing helpers are automatically available in your `config/routes.rb` file.
Rails provides shallow routes and nested resources, but the syntax becomes verbose and repetitive, especially when you want to properly namespace controllers.
Restomatic extends `ActionDispatch::Routing::Mapper` to add these helper methods. The helpers automatically:
202
+
RESTomatic extends `ActionDispatch::Routing::Mapper` to add these helper methods. The helpers automatically:
192
203
193
204
1. Detect singular vs. plural resource names
194
205
2. Apply appropriate module scoping
@@ -197,7 +208,7 @@ Restomatic extends `ActionDispatch::Routing::Mapper` to add these helper methods
197
208
198
209
## Philosophy
199
210
200
-
Rails routing is powerful but can become verbose when building properly organized applications with shallow routes and namespaced controllers. Restomatic embraces Rails conventions while reducing boilerplate, making your routes file more readable and maintainable.
211
+
Rails routing is powerful but can become verbose when building properly organized applications with shallow routes and namespaced controllers. RESTomatic embraces Rails conventions while reducing boilerplate, making your routes file more readable and maintainable.
201
212
202
213
## Requirements
203
214
@@ -214,4 +225,4 @@ Rails routing is powerful but can become verbose when building properly organize
214
225
215
226
## License
216
227
217
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
228
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
0 commit comments