Module: Sunrise::Controllers::Manage::ClassMethods

Defined in:
lib/sunrise/controllers/manage.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sunrise/controllers/manage.rb', line 11

def self.extended(base)
  base.class_eval do
    prepend_before_filter :authenticate_user!
    check_authorization
    
    layout "manage"
    respond_to :html
    
    class_attribute :orders_configuration, :instance_writer => false
    
    helper_method :search_filter
  end
end

Instance Method Details

#order_by(*orders) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sunrise/controllers/manage.rb', line 25

def order_by(*orders)
  options = orders.extract_options!
  options.symbolize_keys!
  
  self.orders_configuration = (self.orders_configuration || {}).dup
  
  orders.each do |column|
    self.orders_configuration[column] ||= { :default => false }
    self.orders_configuration[column] = self.orders_configuration[column].merge(options)
  end
end