user18487436
user18487436

Reputation:

Whitelist Parameters in Controller without a Model

I would like to whitelist a parameter from my params. I have a controller ElectiveRecommendationsController that isn't tied to any Model.

enter image description here

How do I whitelist my :electives? I tried the following, but it didn't work.

def permitted_params
  params.permit(:electives)
end

The error I am getting:

enter image description here

Upvotes: 0

Views: 79

Answers (1)

kcdragon
kcdragon

Reputation: 1733

You need to specify that electives is a Hash. You'll want this

def permitted_params
  params.permit(electives: {})
end

Upvotes: 1

Related Questions