gateway/app/models/cms/section.rb

41 lines
627 B
Ruby
Raw Normal View History

module Cms
class Section
include ActiveModel::Model
include ActiveModel::Conversion
include ActiveModel::Dirty
attr_reader :name , :content , :page
def persisted?
false
end
def initialize(page , section_data)
@page = page
@content = section_data
# id = SecureRandom.hex(10) if new or not there
end
def template
@content["template"]
end
2022-11-26 18:07:20 +01:00
def id
@content["id"]
end
def save
false
end
def self.all
@page.sections
end
def self.find(page_name , section_id)
Page.new(name + ".yaml")
end
end
end