Class: Pageflow::FileType
- Inherits:
-
Object
- Object
- Pageflow::FileType
- Defined in:
- lib/pageflow/file_type.rb
Overview
Describes a type of file that can be managed in the editor and used in revisions.
Defined Under Namespace
Classes: NotFoundError
Instance Attribute Summary collapse
-
#collection_name ⇒ String
readonly
Underscored plural name for usage in routes.
-
#editor_partial ⇒ String
readonly
Path of the partial used to render a json representation of the file.
-
#model ⇒ ActiveRecord::Model
readonly
ActiveRecord model that represents the files of this type.
Instance Method Summary collapse
- #i18n_key ⇒ Object private
-
#initialize(options) ⇒ FileType
constructor
Create file type to be returned in PageType#file_types.
- #param_key ⇒ Object (also: #short_name) private
- #type_name ⇒ Object private
Constructor Details
#initialize(options) ⇒ FileType
Create file type to be returned in PageType#file_types.
36 37 38 39 40 |
# File 'lib/pageflow/file_type.rb', line 36 def initialize() @model = .fetch(:model) @editor_partial = .fetch(:editor_partial, nil) @collection_name = .fetch(:collection_name, model.model_name.plural) end |
Instance Attribute Details
#collection_name ⇒ String (readonly)
Underscored plural name for usage in routes.
19 20 21 |
# File 'lib/pageflow/file_type.rb', line 19 def collection_name @collection_name end |
#editor_partial ⇒ String (readonly)
Path of the partial used to render a json representation of the file.
15 16 17 |
# File 'lib/pageflow/file_type.rb', line 15 def editor_partial @editor_partial end |
#model ⇒ ActiveRecord::Model (readonly)
ActiveRecord model that represents the files of this type.
10 11 12 |
# File 'lib/pageflow/file_type.rb', line 10 def model @model end |
Instance Method Details
#i18n_key ⇒ Object
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.
56 57 58 |
# File 'lib/pageflow/file_type.rb', line 56 def i18n_key model.model_name.i18n_key end |
#param_key ⇒ Object Also known as: short_name
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.
43 44 45 |
# File 'lib/pageflow/file_type.rb', line 43 def param_key model.model_name.param_key.to_sym end |
#type_name ⇒ Object
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.
51 52 53 |
# File 'lib/pageflow/file_type.rb', line 51 def type_name model.name end |