Class: ApplicationDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
lib/stationed/generators/templates/application_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.collection_decorator_classObject

Always use our custom PaginatingDecorator to decorate ActiveRelation objects so we can properly delegate Kaminari’s pagination extensions.



4
5
6
# File 'lib/stationed/generators/templates/application_decorator.rb', line 4

def self.collection_decorator_class
  PaginatingDecorator
end

Instance Method Details

#haml_object_refObject

Override Haml’s default object notation to use the class name it would have used had an object not been decorated.

This removes the need for markup like:

%div[person.person]
  ...

Instead allowing:

%div[person]
  ...


20
21
22
# File 'lib/stationed/generators/templates/application_decorator.rb', line 20

def haml_object_ref
  model.class.to_s.underscore
end