Class: Pageflow::SiteRootEntryForm Private

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/pageflow/site_root_entry_form.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, site) ⇒ SiteRootEntryForm

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SiteRootEntryForm.

API:

  • private



10
11
12
13
# File 'app/models/pageflow/site_root_entry_form.rb', line 10

def initialize(attributes, site)
  super(attributes)
  @site = site
end

Instance Attribute Details

#entry_idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



6
7
8
# File 'app/models/pageflow/site_root_entry_form.rb', line 6

def entry_id
  @entry_id
end

Instance Method Details

#entryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



23
24
25
# File 'app/models/pageflow/site_root_entry_form.rb', line 23

def entry
  @entry ||= @site.entries.find_by_id(entry_id)
end

#saveObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



15
16
17
18
19
20
21
# File 'app/models/pageflow/site_root_entry_form.rb', line 15

def save
  return false unless valid?

  entry.permalink.update(allow_root_path: true,
                         directory: @site.permalink_directories.find_by_path(''),
                         slug: '')
end