|
@@ -28,10 +28,11 @@ class ActivitiesController < ApplicationController
|
28
|
28
|
# POST /activities.json
|
29
|
29
|
def create
|
30
|
30
|
@activity = Activity.new(activity_params)
|
|
31
|
+ @activity.group = @group
|
31
|
32
|
|
32
|
33
|
respond_to do |format|
|
33
|
34
|
if @activity.save
|
34
|
|
- format.html { redirect_to @activity, notice: 'Activity was successfully created.' }
|
|
35
|
+ format.html { redirect_to group_activity_url(@group, @activity), notice: 'Activity was successfully created.' }
|
35
|
36
|
format.json { render :show, status: :created, location: @activity }
|
36
|
37
|
else
|
37
|
38
|
format.html { render :new }
|
|
@@ -45,7 +46,7 @@ class ActivitiesController < ApplicationController
|
45
|
46
|
def update
|
46
|
47
|
respond_to do |format|
|
47
|
48
|
if @activity.update(activity_params)
|
48
|
|
- format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }
|
|
49
|
+ format.html { redirect_to group_activity_url(@group, @activity), notice: 'Activity was successfully updated.' }
|
49
|
50
|
format.json { render :show, status: :ok, location: @activity }
|
50
|
51
|
else
|
51
|
52
|
format.html { render :edit }
|
|
@@ -59,7 +60,7 @@ class ActivitiesController < ApplicationController
|
59
|
60
|
def destroy
|
60
|
61
|
@activity.destroy
|
61
|
62
|
respond_to do |format|
|
62
|
|
- format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }
|
|
63
|
+ format.html { redirect_to group_activities_url(@group), notice: 'Activity was successfully destroyed.' }
|
63
|
64
|
format.json { head :no_content }
|
64
|
65
|
end
|
65
|
66
|
end
|
|
@@ -76,6 +77,6 @@ class ActivitiesController < ApplicationController
|
76
|
77
|
|
77
|
78
|
# Never trust parameters from the scary internet, only allow the white list through.
|
78
|
79
|
def activity_params
|
79
|
|
- params.fetch(:activity, {})
|
|
80
|
+ params.require(:activity).permit(:public_name, :secret_name, :description, :location, :start, :end, :deadline, :show_hidden)
|
80
|
81
|
end
|
81
|
82
|
end
|