FauxRM.model('Setting');

Object.extend(Setting, {
  
  loadSettings : function() {
    var afterLoad = function() {
      var active = Setting.get('active_page');
      if (!active) (new Setting({value:null}, 'active_page')).save();
      active = Setting.get('active_page');
      
      var lights = Setting.get('light_switch');
      if (!lights) (new Setting({value:'on'}, 'light_switch')).save();
      
      var first = Setting.get('first_timer');
      if (!first) (new Setting({value:true}, 'first_timer')).save();
      first = Setting.get('first_timer');
      
      Page.loadPages(active, first);
    }.bind(this);
    
    this.load(afterLoad);
  }
  
});


Setting.addMethods({
  
});