Created
January 14, 2016 18:20
-
-
Save kenmazaika/1c065bb1299424343781 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Quote < ActiveRecord::Base | |
| validates :saying, presence: true, length: { maximum: 140, minimum: 3 } | |
| validates :author, presence: true, length: { maximum: 50, minimum: 3 } | |
| before_create :remove_leading_and_trailing_quotes | |
| def remove_leading_and_trailing_quotes | |
| self.saying = self.saying.gsub(/\A"/, '').gsub(/"\Z/, '') | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment