Skip to content

Commit

Permalink
Rails 5 - Comments Controller Spec fix (#336)
Browse files Browse the repository at this point in the history
* permit params and convert to_hash because params no longer inherits from HashWithIndifferentAccess

* fix backwards breaking behavior. update moderations_controller. need to permit params in order for added attributes to be included when converting to a hash with to_h

* permit params on index and then convert params .to_h so serializer.page has access to parameters
  • Loading branch information
yuenmichelle1 authored Jul 1, 2024
1 parent 0bec7ea commit f815fae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/concerns/action_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ def index
authorize model_class
scoped = policy_scope model_class
params[:sort] ||= serializer_class.default_sort if serializer_class.default_sort
render json: serializer_class.page(params, scoped, current_user: current_user)
params.permit!
render json: serializer_class.page(params.to_h, scoped, current_user: current_user)
end

def show
Expand Down

0 comments on commit f815fae

Please sign in to comment.