Sha256: 19db38436bad5ac5d4938412ea32a25c89d430871a580bac3b941722f4ee47f6

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

module Storytime
  class Site < ActiveRecord::Base
    enum post_slug_style: [:default, :day_and_name, :month_and_name, :post_name]
    enum root_page_content: [:posts, :page]

    validates :root_post_id, presence: true, if: ->(site){ site.root_page_content == "page" }
    validates :title, length: { in: 1..200 }

    def save_with_seeds(user)
      setup_seeds
      user.update_attributes(storytime_role: Storytime::Role.find_by(name: "admin"))
      save
    end

    def setup_seeds
      Storytime::PostType.seed
      Storytime::Role.seed
      Storytime::Action.seed
      Storytime::Permission.seed
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storytime-0.0.2 app/models/storytime/site.rb