mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 11:42:19 -05:00
22 lines
510 B
Ruby
22 lines
510 B
Ruby
class CommentsController < ApplicationController
|
|
before_action :get_commentable
|
|
before_action :get_comment
|
|
|
|
def show
|
|
end
|
|
|
|
private
|
|
|
|
def get_comment
|
|
@comment = @commentable.comments.find_param(params[:id])
|
|
end
|
|
|
|
def get_commentable
|
|
commentable = params[:commentable_class].constantize
|
|
commentable_param = params[:commentable_class].parameterize + "_id"
|
|
id = params[commentable_param]
|
|
@commentable = policy_scope(commentable).find_param(id)
|
|
authorize @commentable
|
|
end
|
|
end
|