Newer
Older
dmpopidor / app / models / research_output_type.rb
@Quentin SONREL Quentin SONREL on 20 Jan 2020 597 bytes Added structured schema/answers models and tables
# == Schema Information
#
# Table name: research_output_types
#
#  id         :integer          not null, primary key
#  label      :string           not null
#  slug       :string           not null
#  is_other   :boolean          default("false"), not null
#  created_at :datetime         not null
#  updated_at :datetime         not null
#

class ResearchOutputType < ActiveRecord::Base
  has_many :research_outputs

  ##
  # Before save & create, generate the slug
  before_save :generate_slug

  def generate_slug
    if self.label
      self.slug = self.label.parameterize
    end
  end
end