Class: Cms::AbstractFileBlock
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Cms::AbstractFileBlock
- Defined in:
- app/models/cms/abstract_file_block.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#file_size ⇒ Object
Exists here so FileBrowser can polymorphically call file_size on Page, Images, Files, etc.
-
#parent ⇒ Cms::Section
Return the parent section for this block.
- #path ⇒ Object
- #set_attachment_path ⇒ Object
- #set_attachment_section ⇒ Object
Class Method Details
.publishable? ⇒ Boolean
29 30 31 |
# File 'app/models/cms/abstract_file_block.rb', line 29 def self.publishable? true end |
Instance Method Details
#file_size ⇒ Object
Exists here so FileBrowser can polymorphically call file_size on Page, Images, Files, etc.
21 22 23 |
# File 'app/models/cms/abstract_file_block.rb', line 21 def file_size file.size.round_bytes end |
#parent ⇒ Cms::Section
Return the parent section for this block.
16 17 18 |
# File 'app/models/cms/abstract_file_block.rb', line 16 def parent file.parent end |
#path ⇒ Object
25 26 27 |
# File 'app/models/cms/abstract_file_block.rb', line 25 def path file.url end |
#set_attachment_path ⇒ Object
33 34 35 36 37 |
# File 'app/models/cms/abstract_file_block.rb', line 33 def if @attachment_file_path && @attachment_file_path != .file_path .file_path = @attachment_file_path end end |
#set_attachment_section ⇒ Object
39 40 41 42 43 |
# File 'app/models/cms/abstract_file_block.rb', line 39 def if @attachment_section_id && @attachment_section_id != .section .section_id = @attachment_section_id end end |