Class: Meta2::Setting

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/meta2/setting.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



49
50
51
52
53
54
55
56
# File 'app/models/meta2/setting.rb', line 49

def method_missing(method, *args)
  check_name = method.to_s.gsub '?', ''
  unless %w(formats defaults parts).include? check_name
    super(method, args) and return
  end

  self.section == check_name
end

Class Method Details

.app_namesObject



59
60
61
# File 'app/models/meta2/setting.rb', line 59

def app_names
  self.group(:app_name).pluck :app_name
end

.sectionsObject



63
64
65
# File 'app/models/meta2/setting.rb', line 63

def sections
  Meta2.config.sections
end