Method: Espresso::View::InstanceMethods#model_classes
- Defined in:
- lib/espresso/view.rb
#model_classes(model) ⇒ Object
Model‘s classes, based on Model.model_modifiers
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/espresso/view.rb', line 83 def model_classes(model) klass = model.class main_class = klass.name.underscore.gsub(/(_|\/)/, '-') modifiers = if klass.respond_to?(:model_modifiers) klass.model_modifiers.find_all do |modifier| method = "#{modifier}?" model.respond_to?(method) && model.send(method) end else [] end Espresso::View.block_classes(main_class, modifiers) end |