Created
February 26, 2018 04:21
-
-
Save alanmaciel/2a193a391e156ead5349f718d92e4e4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validates :title, :released_on, :duration, presence: true | |
validates :description, length: { minimum: 25 } | |
validates :total_gross, numericality: { greater_than_or_equal_to: 0 } | |
validates :image_file_name, allow_blank: true, format: { | |
with: /\w+\.(gif|jpg|png)\z/i, | |
message: "must reference a GIF, JPG, or PNG image" | |
} | |
RATINGS = %w(G PG PG-13 R NC-17) | |
validates :rating, inclusion: { in: RATINGS } | |
validates :name, presence: true | |
validates :email, presence: true, | |
format: /\A\S+@\S+\z/, | |
uniqueness: { case_sensitive: false } | |
validates :password, length: { minimum: 10, allow_blank: true } | |
validates_format_of :username,· | |
:with => /\A[A-Za-z\d_]+$\z/,· | |
:message => "can only be alphanumeric with no spaces" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment