Generic-user-small Daniel Nelson 2 posts

For example, given a User model with a :role attribute, such that the default value for that attribute is defined in the database, the application needs to ensure that the user creation form is not spoofed and a :role provided. Otherwise, @user = User.new(params[:user]) would enable new users to be created with arbitrary roles.

I know that I could create my own validate function, but it seems like validates_absence_of functionality is as foundational as validates_presence_of, so I’m wondering if I am misunderstanding something.

Thank You,

Daniel

 
Generic-user-small Daniel Nelson 2 posts

attr_protected does this

Also see attr_accessible

2 posts, 1 voice