appirits/comable

View on GitHub
core/app/models/comable/navigation.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Comable
  class Navigation < ActiveRecord::Base
    include Comable::Ransackable

    has_many :navigation_items

    accepts_nested_attributes_for :navigation_items, allow_destroy: true

    validates :name, length: { maximum: 255 }, presence: true
    validates :navigation_items, presence: true

    scope :by_newest, -> { reorder(created_at: :desc) }
  end
end