Skip to content

Instantly share code, notes, and snippets.

View adam's full-sized avatar

Adam French adam

View GitHub Profile
namespace :app do
desc 'setup'
task :setup => ['dm:db:automigrate', 'app:create_base_users', 'app:create_base_projects']
task :create_base_users => :merb_env do
User.create(
:login => 'admin',
:email => 'adam@wieck.com',
:password => 'sekrit',
:password_confirmation => 'sekrit',
# this demonstrates using dm-fauxtures to fill an ticketing systems database with fixtures.
# invoke by using `rake app:setup`
namespace :app do
desc 'setup'
task :setup => ['dm:db:automigrate', 'app:create_base_users', 'app:create_base_projects']
task :create_base_users => :merb_env do
User.create(
:login => 'admin',
module Authorization
module User
# include ::DataMapper::Resource
# This is a "vanity" relationship. A user may not have all permissions for an entire role,
# but still may be said to be a member of the role.
# has_and_belongs_to_many :roles
has 1.0/0, :roles, :through => ::DataMapper::Resource
# This relationship contains the actual list of permissions the user has been granted.
has 1.0/0, :permissions, :through => ::DataMapper::Resource