We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5af406 commit ecbde54Copy full SHA for ecbde54
app/models/hotel.rb
@@ -103,6 +103,13 @@ def do_something_after_destroy
103
validates :vacancy, inclusion: { in: [true, false] }
104
validates :public_likes, exclusion: { in: [nil] }
105
106
+ validate :custom_validation
107
+ def custom_validation
108
+ return unless email.include?('rhossilibunkhouse.com')
109
+
110
+ errors.add(:email, 'cannot be from rhossilibunkhouse.com')
111
+ end
112
113
def set_timestamps
114
current_time = Time.now
115
self.created_at = current_time if new_record?
0 commit comments