Module: Perron::Resource::Core
- Extended by:
- ActiveSupport::Concern
- Included in:
- Perron::Resource
- Defined in:
- lib/perron/resource/core.rb
Instance Method Summary collapse
- #association_value(key) ⇒ Object
- #model_name ⇒ Object
- #persisted? ⇒ Boolean
- #to_model ⇒ Object
- #to_partial_path ⇒ Object
Instance Method Details
#association_value(key) ⇒ Object
14 |
# File 'lib/perron/resource/core.rb', line 14 def association_value(key) = [key] |
#model_name ⇒ Object
12 |
# File 'lib/perron/resource/core.rb', line 12 def model_name = self.class.model_name |
#persisted? ⇒ Boolean
8 |
# File 'lib/perron/resource/core.rb', line 8 def persisted? = true |
#to_model ⇒ Object
10 |
# File 'lib/perron/resource/core.rb', line 10 def to_model = self |
#to_partial_path ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/perron/resource/core.rb', line 16 def to_partial_path @to_partial_path ||= begin element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self.class.model_name)) collection = ActiveSupport::Inflector.tableize(self.class.model_name) File.join("content", collection, element) end end |