rails/rails — Issue #4989: ActiveModel::MissingAttributeError for association
Author: pedroteixeira
Created: 2012-02-10 12:49:55+00:00
State: open

Simple example to reproduce:
# rails 3.2.1
# config.active_record.mass_assignment_sanitizer = :strict

class Model < ActiveRecord::Base
belongs_to :user
end

> Model.new(:user => nil)
results in ActiveModel::MissingAttributeError: can't write unknown attribute `author'

> Model.new(:user_id => nil)
works fine.

This is exception is pretty bad since breaks tons of code.. any suggestions?