Extract BubbleScoped
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class BoostsController < ApplicationController
|
||||
before_action :set_bubble
|
||||
include BubbleScoped
|
||||
|
||||
def index
|
||||
end
|
||||
@@ -10,9 +10,4 @@ class BoostsController < ApplicationController
|
||||
def create
|
||||
@bubble.boosts.create!
|
||||
end
|
||||
|
||||
private
|
||||
def set_bubble
|
||||
@bubble = Bubble.find(params[:bubble_id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :set_bubble
|
||||
include BubbleScoped
|
||||
|
||||
def create
|
||||
@bubble.comments.create!(comment_params)
|
||||
@@ -10,8 +10,4 @@ class CommentsController < ApplicationController
|
||||
def comment_params
|
||||
params.require(:comment).permit(:body)
|
||||
end
|
||||
|
||||
def set_bubble
|
||||
@bubble = Bubble.find(params[:bubble_id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
module BubbleScoped
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :set_bubble
|
||||
end
|
||||
|
||||
private
|
||||
def set_bubble
|
||||
@bubble = Bubble.find(params[:bubble_id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user