Created
April 8, 2021 07:32
-
-
Save bochi/29bb1e3ef769854d6251dad99b01e0a3 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
class Source < ApplicationRecord | |
has_many :reports, :through => :logs | |
has_many :logs | |
validates_lengths_from_database | |
validates :value, :presence => true | |
def to_s | |
value | |
end | |
# DEPRECATED: use Rails method (no warning because this is called many times) | |
def self.find_or_create(value) | |
find_or_create_by(value: value) | |
end | |
def skip_strip_attrs | |
['value'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment