Skip to content

Instantly share code, notes, and snippets.

@craigw
Created March 8, 2010 21:00
Show Gist options
  • Save craigw/325744 to your computer and use it in GitHub Desktop.
Save craigw/325744 to your computer and use it in GitHub Desktop.
# 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