Sha256: 85c2297466b837defda6a87bfe349b4266c03580907fa6fe65501f2032299ad8
Contents?: true
Size: 397 Bytes
Versions: 5
Compression:
Stored size: 397 Bytes
Contents
class ArgumentTopic < ActiveRecord::Base has_many :arguments validates :name, presence: true, uniqueness: { case_sensitive: false } attr_accessible :name, :text def self.find_or_create_by_name(name) resource = where('LOWER(name) = ?', name.to_s.strip.downcase).first if resource resource else resource = create(name: name.to_s.strip) end end end
Version data entries
5 entries across 5 versions & 1 rubygems