Create users, groups, user_summary models
This commit is contained in:
parent
76229c8cc5
commit
3258aa1e0b
10 changed files with 76 additions and 0 deletions
7
app/models/group.rb
Normal file
7
app/models/group.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Group
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :group_name, type: String
|
||||||
|
embeds_many :UserSummary
|
||||||
|
end
|
||||||
8
app/models/user.rb
Normal file
8
app/models/user.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
class User
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :user_id, type: BSON::ObjectId
|
||||||
|
field :user_name, type: String
|
||||||
|
field :user_description, type: String
|
||||||
|
end
|
||||||
7
app/models/user_summary.rb
Normal file
7
app/models/user_summary.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class UserSummary
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :user_id, type: BSON::ObjectId
|
||||||
|
field :user_name, type: String
|
||||||
|
end
|
||||||
0
app/views/main/.keep
Normal file
0
app/views/main/.keep
Normal file
11
test/fixtures/groups.yml
vendored
Normal file
11
test/fixtures/groups.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
11
test/fixtures/user_summaries.yml
vendored
Normal file
11
test/fixtures/user_summaries.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
11
test/fixtures/users.yml
vendored
Normal file
11
test/fixtures/users.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
7
test/models/group_test.rb
Normal file
7
test/models/group_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class GroupTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
7
test/models/user_summary_test.rb
Normal file
7
test/models/user_summary_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class UserSummaryTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
7
test/models/user_test.rb
Normal file
7
test/models/user_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class UserTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue