How to validate a single attribute for a submitting ActiveRecord instead of all its attributes?
问题 I am using Ruby on Rails 3 and I would like to validate a single attribute for a submitting ActiveRecord instead of all its attributes. For example, in my model I have: validates :firstname, :presence => true, ... validates :lastname, :presence => true, ... I would like to run validation on the :firstname and on the :lastname separately . Is it possible? If so, how can I make that? P.S.: I know that for validation purposes there are methods like "validates_presence_of", "validates