Created
January 19, 2012 13:03
-
-
Save pbruna/1639968 to your computer and use it in GitHub Desktop.
Treequel adding to many extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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