Rails 4 Strong Parameters - Handling Missing Model Params Hash
问题 Models: Posts and Users Post belongs_to :user User has_many :posts Simple. Assuming a few users exist, we visit the edit page for a Post. <%= form_for @post do |f| %> ... <% User.all.each do |user| %> <div><%= f.radio_button "user_id", user.id %></div> <% end %> ... The Post's Controller leverages Rails 4 strong parameters. params.require(:post).permit(:user_id) Assume the edit post form only has the radio buttons as fields. Problem: ActionController::ParameterMissing exception is thrown.