-
-
Save ged/1643614 to your computer and use it in GitHub Desktop.
Treequel adding to many extensions
This file contains 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 = @directory.search( params[:id], :base ) | |
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) | |
# (assuming id="uid=foobar,o=company,c=cl") | |
attrs, base = id.split(/,/, 2) | |
# => ['uid=foobar', 'o=company,c=cl'] | |
# 'uid=foobar' is equivalent to { :uid => 'foobar' } | |
# and the #from method can reset the base for one search (without resetting it | |
# for the whole model): | |
filter(attrs).from(base).first | |
end | |
end |
This file contains 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