I have a create method that builds a new model through an association and I was expecting it to return a 400 response with some text if no params were in the POST request. However, I get an error.
This is in Rails 4.0.2
controller methods:
def create
@cast_profile = current_user.build_cast_profile(cast_profile_params)
if @cast_profile.save
redirect_to cast_profile_path
else
render :edit
end
end
def cast_profile_params
params.require(:cast_profile).permit(:name, :email, :public)
end
If I pass the params its all fine but I'm trying to test the bad request scenario. Here's the error:
ActionController::ParameterMissing: param not found: cast_profile
I could rescue it explicitly but I thought strong parameters was supposed to do that automatically.