I want to validate 1 parameter in model method, but I can not find any suitable answer, please Show correctly.
class users & lt; ActiveRecord :: Base Valid: Username, Presence: Right, Length: 4..5, Unique: Correct Valid: Email, Attendance: True, Unique: Correct, Format: {with: / \ A [a-z0-9 \ . ] + @ ([Az] {1,10}}. {1,2} [az] {2,4} \ z /} def self.get_post (id) # How to make valid ID calls ??? Confirmation Does: ID, numeracy: if id.valid is true? # True code and # false code end-end def # change_profile # How to validate user and email username. Valid? Email.valid? # Some_code .... Thank you all.
you validate Can not use
, if you can do id.is_a
def self.get_post (id) instead? SECURITY # correct code and # false address end end
No comments:
Post a Comment