Commit 237744e5238dac7144a1c5eb4748367b9377770e
1 parent
4be375ef
Exists in
master
and in
1 other branch
Plugging app params for new & edit actions.
Showing
1 changed file
with
7 additions
and
4 deletions
Show diff stats
app/controllers/apps_controller.rb
| @@ -25,14 +25,12 @@ class AppsController < InheritedResources::Base | @@ -25,14 +25,12 @@ class AppsController < InheritedResources::Base | ||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def new | 27 | def new |
| 28 | - build_resource.watchers.build | ||
| 29 | - @app.issue_tracker = IssueTracker.new | 28 | + plug_params build_resource |
| 30 | new! | 29 | new! |
| 31 | end | 30 | end |
| 32 | 31 | ||
| 33 | def edit | 32 | def edit |
| 34 | - resource.watchers.build if resource.watchers.none? | ||
| 35 | - resource.issue_tracker = IssueTracker.new if resource.issue_tracker.nil? | 33 | + plug_params resource |
| 36 | edit! | 34 | edit! |
| 37 | end | 35 | end |
| 38 | 36 | ||
| @@ -45,6 +43,11 @@ class AppsController < InheritedResources::Base | @@ -45,6 +43,11 @@ class AppsController < InheritedResources::Base | ||
| 45 | {:app_name => resource.name} | 43 | {:app_name => resource.name} |
| 46 | end | 44 | end |
| 47 | 45 | ||
| 46 | + def plug_params app | ||
| 47 | + app.watchers.build if app.watchers.none? | ||
| 48 | + app.issue_tracker = IssueTracker.new if app.issue_tracker.nil? | ||
| 49 | + end | ||
| 50 | + | ||
| 48 | # email_at_notices is edited as a string, and stored as an array. | 51 | # email_at_notices is edited as a string, and stored as an array. |
| 49 | def parse_email_at_notices_or_set_default | 52 | def parse_email_at_notices_or_set_default |
| 50 | if params[:app] && val = params[:app][:email_at_notices] | 53 | if params[:app] && val = params[:app][:email_at_notices] |