What is the difference between attr_accessible(*attributes) & attr_protected(*attributes)?
问题 What is the difference between attr_accessible(*attributes) & attr_protected(*attributes) ? Examples would be nice. I see many developers use these in their models. I googled for the differences, but I don't get exactly what they are. What is the importance and its necessity in different scenarios? 回答1: attr_accessible (documentation) says "the specified attributes are accessible and all others are protected" (think of it as whitelisting.) whereas attr_protected (documentation) says "the