# class Puppet::Indirector::ActiveRecord

### Attributes

ar_model[RW]

### Public Class Methods

new() click to toggle source

    # File lib/puppet/indirector/active_record.rb, line 16
    def initialize
      Puppet::Rails.init
    end

use_ar_model(klass) click to toggle source

    # File lib/puppet/indirector/active_record.rb, line 8
    def self.use_ar_model(klass)
      self.ar_model = klass
    end

### Public Instance Methods

ar_model() click to toggle source

    # File lib/puppet/indirector/active_record.rb, line 12
    def ar_model
      self.class.ar_model
    end

find(request) click to toggle source

    # File lib/puppet/indirector/active_record.rb, line 20
    def find(request)
      return nil unless instance = ar_model.find_by_name(request.key)
      instance.to_puppet
    end

save(request) click to toggle source

    # File lib/puppet/indirector/active_record.rb, line 25
    def save(request)
      ar_model.from_puppet(request.instance).save
    end