Skip to content

Commit

Permalink
πŸ› Fix unpermitted params
Browse files Browse the repository at this point in the history
This commit will fix the unpermitted params error that occurs when
trying to save the form.  It seemed that shoveling the terms in broke
functionality for other terms.  Instead we override the class method and
add it to the array of terms.
  • Loading branch information
kirkkwang committed Nov 16, 2023
1 parent 77b9c0b commit 587b2e2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/forms/hyrax/pdf_form_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ module PdfFormBehavior

self.terms += %i[show_pdf_viewer show_pdf_download_button]
self.hidden_terms = %i[show_pdf_viewer show_pdf_download_button]
# Not sure why this is needed but the form was not working without it
# it was getting a Unpermitted parameter error for these terms
permitted_params << %i[show_pdf_viewer show_pdf_download_button]
end

def hidden?(key)
hidden_terms.include? key.to_sym
end

class_methods do
# Not sure why this is needed but the form was no working without it
# it was getting an Unpermitted paratemter error for these terms
def permitted_params
super + %i[show_pdf_viewer show_pdf_download_button]
end
end
end
end

0 comments on commit 587b2e2

Please sign in to comment.