Skip to content

Instantly share code, notes, and snippets.

@caseyprovost
Created July 26, 2017 17:19
Show Gist options
  • Select an option

  • Save caseyprovost/508395c084e08e97b35de392d791dfdf to your computer and use it in GitHub Desktop.

Select an option

Save caseyprovost/508395c084e08e97b35de392d791dfdf to your computer and use it in GitHub Desktop.
class User < ApplicationRecord
attr_accessor :from_comic_con_campaign
validates :twitter_username, presence: true, if: -> { from_comic_con_campaign }
validates :d_and_d_handle, presence: true, if: -> { from_comic_con_campaign }
validates :password, presence: true, confirmation: true
validates :first_name, :last_name, :email, presence: true
validates :email, format: { with: /@/, message: "is invalid" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment