Devise - how to add validation to user model

I use 3 w rails. How can I add validation to create an extra column in my user table, column: first_name

Any ideas?

thank

+3
source share
2 answers
class User < ActiveRecord::Base
  validates :first_name, :presence => true
end
+1
source

An old question, but at the top of the Google search. A new answer is required.

I ran into this problem until I entered my new column / attribute in the attr_accessible chain. Then any checks that I wrote were performed properly.

0
source

Source: https://habr.com/ru/post/1787079/


All Articles