Skip to content

Instantly share code, notes, and snippets.

View dmilith's full-sized avatar
🤓
Calculating infinity…

Daniel (dmilith) Dettlaff dmilith

🤓
Calculating infinity…
View GitHub Profile
class Port
include DataMapper::Resource
belongs_to :rack_app
belongs_to :user
property :id, Serial, :index => true
property :port, Integer, :default => 3000, :nullable => false
property :user_id, Integer, :nullable => true, :index => true
class User
include DataMapper::Resource
property :id, Serial, :index => true
property :login, String, :limit => 75, :nullable => false
property :pass, String, :limit => 100
property :first_name, String, :limit => 75
property :last_name, String, :limit => 75
property :email, String, :limit => 75, :nullable => false
property :telephone, String, :limit => 75
user.rb
has n, :usage_permissions
has n, :domains, :through => :usage_permissions, :mutable => true # workaround XXX http://datamapper.lighthouseapp.com/projects/20609/tickets/485-has-n-through-does-not-allow-saving-of-model
has n, :subdomains
domain.rb
has n, :usage_permissions
class Subdomain
include DataMapper::Resource
property :id, Serial, :index => true
property :user_id, Integer, :index => true
property :domain_id, Integer, :index => true
property :rack_app_id, Integer, :index => true
property :name, String
belongs_to :rack_app
NoMethodError: undefined method `attach_parent' for #<DataMapper::Associations::RelationshipChain:0x7f8cdad85298>
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/associations/one_to_many.rb:302:in `save_resource'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/associations/relationship.rb:172:in `with_repository'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/support/kernel.rb:6:in `repository'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core.rb:181:in `repository'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/repository.rb:44:in `scope'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core.rb:181:in `repository'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/support/kernel.rb:6:in `repository'
from /usr/loca
class User
include DataMapper::Resource
has n, :usage_permissions
has n, :domains, :through => :usage_permissions, :mutable => true # workaround XXX http://datamapper.lighthouseapp.com/projects/20609/tickets/485-has-n-through-does-not-allow-saving-of-model
has n, :subdomains
has n, :ports
has n, :memory_usage_records
...
class UsagePermission
include DataMapper::Resource
property :id, Serial, :index => true
property :available_subdomains_count, Integer
property :domain_id, Integer, :index => true
property :user_id, Integer, :index => true
property :created_at, DateTime
property :created_on, Date
property :updated_at, DateTime
root@vks-mirmil:# irb -d
Loading... Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:871 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:877 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:35 - no such file to load -- Win32API
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- wirble
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- map_by_method
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- what_methods
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- duration
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no su
deldagorin:~ dmilith$ sudo gem install teamon-merb-flash
Building native extensions. This could take a while...
Successfully installed do_sqlite3-0.9.9
Successfully installed randexp-0.1.4
Successfully installed dm-sweatshop-0.9.8
Successfully installed merb-1.0.6.1
Successfully installed teamon-merb-flash-1.0.0
5 gems installed
Installing ri documentation for randexp-0.1.4...
Installing ri documentation for dm-sweatshop-0.9.8...
make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PG_ENCODING_TO_CHAR -I/opt/local/include -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -c libpq-compat.c
libpq-compat.c: In function ‘PQescapeBytea’:
libpq-compat.c:104: warning: incompatible implicit declaration of built-in function ‘sprintf’
libpq-compat.c:104: warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness
libpq-compat.c: In function ‘PQunescapeBytea’:
libpq-compat.c:158: warning: incompatible implicit declaration of built-in function ‘strlen’
libpq-compat.c:158: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
libpq-compat.c: In function ‘PQescapeBytea’:
libpq-compat.c:104: warning: incompatible implicit declaration of built-in function ‘sprintf’