Created
March 8, 2010 21:00
-
-
Save craigw/325744 to your computer and use it in GitHub Desktop.
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
# app/models/physical/organisation.rb | |
module Physical | |
class Organisation < ActiveRecord::Base | |
validates :foo, :bar, :baz, :quuz | |
end | |
end | |
# app/models/physical/user.rb | |
module Physical | |
class User < ActiveRecord::Base | |
validates_presence_of :email_address, :name, :this, :that, :other | |
end | |
end | |
# app/models/logical/organisation_user_manager.rb | |
module Logical | |
class OrganisationUserManager | |
USER_PERFORMANCE_BOUNDARY = 100 | |
def initialize(organisation) | |
@organisation = organisation | |
@users = organisation.users.to_a | |
end | |
def add_user(user) | |
@users << user | |
end | |
def okay? | |
@users.size < USER_PERFORMANCE_BOUNDARY | |
end | |
def save | |
@organisation.users = @users | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment