-
Notifications
You must be signed in to change notification settings - Fork 2
/
13-auto-actions-for-project.patch
31 lines (20 loc) · 1.13 KB
/
13-auto-actions-for-project.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
auto-actions-for-project
From: Bryan Larsen <[email protected]>
Here's another similar trick. Browse to one of your projects. You'll see the page says "No stories to display" but there's no way to add one. Hobo has support for this but we need to switch it on. Add the following declaration to the stories controller:
SHOW_PATCH
This creates nested routes and their corresponding actions:
- `/project/123/stories/new` routed to `StoriesController#new_for_project`
- `/project/123/stories` (POST) routed to `StoriesController#create_for_project`
Hobo's page generators will respond to the existence of these routes and add a "New Story" link to the project page, and an appropriate "New Story" page.
---
app/controllers/stories_controller.rb | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb
index f0dd368..0e6095b 100644
--- a/app/controllers/stories_controller.rb
+++ b/app/controllers/stories_controller.rb
@@ -4,4 +4,6 @@ class StoriesController < ApplicationController
auto_actions :all
+ auto_actions_for :project, [:new, :create]
+
end