aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/dashboard.rb
blob: e0857dca387ce6ca6226150d5c1efb17138c4d42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# The default Dashboard implementation can be customized in an initializer :
#
#   Rails.application.config.to_prepare do
#     Dashboard.default_class = Custom::Dashboard
#   end
#
class Dashboard
  include ActiveModel::Conversion

  @@default_class = self
  mattr_accessor :default_class

  def self.model_name
    ActiveModel::Name.new Dashboard, Dashboard, "Dashboard"
  end

  attr_reader :context
  def initialize(context)
    @context = context
  end

  def self.create(context)
    default_class.new context
  end

  def current_organisation
    context.send(:current_organisation)
  end

end