0

Curious about Rails models - in Hartl's Rails Tutorial, he has a User model that includes the following has_many :microposts attr_accessor :remember_token, :activation_token, :reset_token before_save :downcase_email before_create :create_activation_digest has_secure_password

My question is - does the order you put these in matter?

kongzi
  • 5
  • 3

2 Answers2

0

No not all. You can declare these in anyone set of your choice.

Pragash
  • 713
  • 7
  • 9
0

I think that it is not necessary that validations follow any specific order. But you should keep your every validation flexible so that even if presence/length validation fails on any parameter, manipulation over it doesn't throw an error.
You can refer to this answer
Controlling the order of rails validations

Community
  • 1
  • 1
akash
  • 1,801
  • 7
  • 24
  • 42