Class: BaseController

Inherits:
InheritedResources::Base
  • Object
show all
Defined in:
app/controllers/base_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.responderObject



15
16
17
# File 'app/controllers/base_controller.rb', line 15

def responder
  Adva::Responder
end

.sortable?(order) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/controllers/base_controller.rb', line 19

def sortable?(order)
  !!sortable_direction(order)
end

.sortable_direction(order) ⇒ Object



23
24
25
# File 'app/controllers/base_controller.rb', line 23

def sortable_direction(order)
  self.sortable.assoc(order.to_sym).last rescue nil
end

Instance Method Details

#collectionObject



32
33
34
# File 'app/controllers/base_controller.rb', line 32

def collection
  params[:order].present? ? sort(super, params[:order]) : super
end

#siteObject



28
29
30
# File 'app/controllers/base_controller.rb', line 28

def site
  @site ||= Site.by_host(request.host_with_port)
end