Add initial models and corresponding test files

This commit is contained in:
Martin Lensment 2014-06-16 17:21:01 +03:00
parent bca4470643
commit 542ea5101e
28 changed files with 548 additions and 8 deletions

View file

4
app/models/address.rb Normal file
View file

@ -0,0 +1,4 @@
class Address < ActiveRecord::Base
belongs_to :contact
belongs_to :country
end

3
app/models/contact.rb Normal file
View file

@ -0,0 +1,3 @@
class Contact < ActiveRecord::Base
has_many :addresses
end

3
app/models/country.rb Normal file
View file

@ -0,0 +1,3 @@
class Country < ActiveRecord::Base
end

7
app/models/domain.rb Normal file
View file

@ -0,0 +1,7 @@
class Domain < ActiveRecord::Base
belongs_to :registrar
belongs_to :ns_set
belongs_to :owner_contact, class_name: 'Contact'
belongs_to :technical_contact, class_name: 'Contact'
belongs_to :admin_contact, class_name: 'Contact'
end

3
app/models/nameserver.rb Normal file
View file

@ -0,0 +1,3 @@
class Nameserver < ActiveRecord::Base
has_and_belongs_to_many :ns_sets
end

5
app/models/ns_set.rb Normal file
View file

@ -0,0 +1,5 @@
class NsSet < ActiveRecord::Base
belongs_to :registrar
has_many :domains
has_and_belongs_to_many :nameservers
end

5
app/models/registrar.rb Normal file
View file

@ -0,0 +1,5 @@
class Registrar < ActiveRecord::Base
belongs_to :country
has_many :domains
has_many :ns_sets
end

3
app/models/right.rb Normal file
View file

@ -0,0 +1,3 @@
class Right < ActiveRecord::Base
has_and_belongs_to_many :roles
end

4
app/models/role.rb Normal file
View file

@ -0,0 +1,4 @@
class Role < ActiveRecord::Base
has_many :users
has_and_belongs_to_many :rights
end

3
app/models/user.rb Normal file
View file

@ -0,0 +1,3 @@
class User < ActiveRecord::Base
belongs_to :role
end