Skip to content

Commit

Permalink
Fix unscoped issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlON committed Jul 23, 2017
1 parent a6865be commit 70852d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/room_activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class RoomActivitiesController < ApplicationController
before_action :require_room_presence

def new
@room_activities = @room.room_activities.unscoped
@room_activities = @room.room_activities_with_disabled
end

def create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create
end

def edit
@room_activities = @room.room_activities.unscoped
@room_activities = @room.room_activities_with_disabled
end

def update
Expand Down
4 changes: 4 additions & 0 deletions app/models/room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def activities
Activity.where(room_activity_id: room_activity_ids)
end

def room_activities_with_disabled
RoomActivity.where(room_id: id)
end

def create_default_room_activities
RoomActivity::DEFAULT_ROOM_ACTIVITIES.map do |activity_name|
room_activities.create(name: activity_name)
Expand Down

0 comments on commit 70852d1

Please sign in to comment.