Skip to content

Instantly share code, notes, and snippets.

@pbruna
Created January 19, 2012 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pbruna/1639968 to your computer and use it in GitHub Desktop.
Save pbruna/1639968 to your computer and use it in GitHub Desktop.
Treequel adding to many extensions
class OrganizationalUnitsController < ApplicationController
def show
@organizational_unit = OrganizationalUnit.find(params[:id])
end
end
require 'treequel/model'
require 'treequel/model/objectclass'
module OrganizationalUnit
extend Treequel::Model::ObjectClass
extend Global::Class
model_class Treequel::Model
model_bases "o=company,c=cl"
model_objectclasses :organizationalUnit
# id is the dn off the entry we are looking
def self.find(id)
array = id.split(/,/)
name = array.shift.split(/\=/)
query = {name[0].to_sym => name[1]}
base = array.join(",")
model_bases base
filter(query).first
end
end
<div style="float: left;">
<p>
<%= @organizational_unit.description_text %><br/>
<%= @organizational_unit.extensions.size %>
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment