diff options
Diffstat (limited to 'app/controllers/occurrences_controller.rb')
| -rw-r--r-- | app/controllers/occurrences_controller.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/occurrences_controller.rb b/app/controllers/occurrences_controller.rb index 61b42ff..0f30ce3 100644 --- a/app/controllers/occurrences_controller.rb +++ b/app/controllers/occurrences_controller.rb | |||
| @@ -45,7 +45,7 @@ class OccurrencesController < ApplicationController | |||
| 45 | # POST /occurrences | 45 | # POST /occurrences |
| 46 | # POST /occurrences.xml | 46 | # POST /occurrences.xml |
| 47 | def create | 47 | def create |
| 48 | @occurrence = Occurrence.new(params[:occurrence]) | 48 | @occurrence = Occurrence.new(occurrence_params) |
| 49 | 49 | ||
| 50 | respond_to do |format| | 50 | respond_to do |format| |
| 51 | if @occurrence.save | 51 | if @occurrence.save |
| @@ -65,7 +65,7 @@ class OccurrencesController < ApplicationController | |||
| 65 | @occurrence = Occurrence.find(params[:id]) | 65 | @occurrence = Occurrence.find(params[:id]) |
| 66 | 66 | ||
| 67 | respond_to do |format| | 67 | respond_to do |format| |
| 68 | if @occurrence.update_attributes(params[:occurrence]) | 68 | if @occurrence.update(occurrence_params) |
| 69 | flash[:notice] = 'Occurrence was successfully updated.' | 69 | flash[:notice] = 'Occurrence was successfully updated.' |
| 70 | format.html { redirect_to(@occurrence) } | 70 | format.html { redirect_to(@occurrence) } |
| 71 | format.xml { head :ok } | 71 | format.xml { head :ok } |
| @@ -87,4 +87,11 @@ class OccurrencesController < ApplicationController | |||
| 87 | format.xml { head :ok } | 87 | format.xml { head :ok } |
| 88 | end | 88 | end |
| 89 | end | 89 | end |
| 90 | |||
| 91 | private | ||
| 92 | |||
| 93 | def occurrence_params | ||
| 94 | params.require(:occurrence).permit(:start_time, :end_time, :node_id, :event_id) | ||
| 95 | end | ||
| 96 | |||
| 90 | end | 97 | end |
