Sha256: 8d6068a497710112370e2c898a06f57ffe2a4e1f1eb15cc918688bae14de197c

Contents?: true

Size: 517 Bytes

Versions: 7

Compression:

Stored size: 517 Bytes

Contents

module Storytime
  class Navigation < ActiveRecord::Base
    include Storytime::ScopedToSite

    belongs_to :site
    has_many :links, foreign_key: :storytime_navigation_id, dependent: :destroy

    validates_presence_of :name, :handle

    before_validation :set_handle, on: :create

    accepts_nested_attributes_for :links, :reject_if => :all_blank, :allow_destroy => true

  private
    def set_handle
      self.handle = self.handle.present? ? self.handle.parameterize : self.name.parameterize
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
storytime-2.1.6 app/models/storytime/navigation.rb
storytime-2.1.5 app/models/storytime/navigation.rb
storytime-2.1.4 app/models/storytime/navigation.rb
storytime-2.1.3 app/models/storytime/navigation.rb
storytime-2.1.2 app/models/storytime/navigation.rb
storytime-2.1.1 app/models/storytime/navigation.rb
storytime-2.1.0 app/models/storytime/navigation.rb