-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from RailsGirlsCPH/api_prog_and_meeting_part_2
Api prog and meeting part 2
- Loading branch information
Showing
20 changed files
with
292 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class Meetinginterval < ApplicationRecord | ||
has_many :wishes | ||
validates_presence_of :interval | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class Programminglanguage < ApplicationRecord | ||
has_many :wishes | ||
validates_presence_of :language | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
json.call(wish, :id, :goal, :available_online, :available_offline, :language, :interval) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
json.array! @wishes do |wish| | ||
json.partial! 'wish', wish: wish | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,16 @@ | |
Programminglanguage.destroy_all | ||
Wish.destroy_all | ||
users = ApiUser.create([ | ||
{first_name: 'Mary', last_name: 'Black', city: 'Dublin', mentor: true, mentee: false, email: '[email protected]', password_digest: 'password1'}, | ||
{first_name: 'Bob', last_name: 'Dylan', city: 'New York', mentor: true, mentee: true, email: '[email protected]', password_digest: 'password2'}, | ||
{first_name: 'Jane', last_name: 'Smith', city: 'Edinburgh', mentor: false, mentee: true, email: '[email protected]', password_digest: 'password3'} | ||
{first_name: 'Mary', last_name: 'Black', city: 'Dublin', mentor: true, mentee: false, email: '[email protected]', password_digest: 'password1', username: 'user1'}, | ||
{first_name: 'Bob', last_name: 'Dylan', city: 'New York', mentor: true, mentee: true, email: '[email protected]', password_digest: 'password2', username: 'user2'}, | ||
{first_name: 'Jane', last_name: 'Smith', city: 'Edinburgh', mentor: false, mentee: true, email: '[email protected]', password_digest: 'password3', username: 'user3' } | ||
]) | ||
Meetinginterval.create([{interval: 'weekly'}, {interval: 'daily'}]) | ||
Programminglanguage.create([{language: 'python'},{language: 'SCALA'}]) | ||
|
||
users.first.wishes.create([{available_offline: false, available_online: true, goal: 'Code real good'}]) | ||
users.second.wishes.create([{available_offline: true, available_online: true, goal: 'Get smarter'}]) | ||
users.first.wishes.create([{available_offline: false, available_online: true, goal: 'Code really well in Python'}]) | ||
users.first.wishes.create([{available_offline: false, available_online: true, goal: 'Code real good', programminglanguage_id: Programminglanguage.second.id, meetinginterval_id: Meetinginterval.first.id}]) | ||
users.second.wishes.create([{available_offline: true, available_online: true, goal: 'Get smarter', programminglanguage_id: Programminglanguage.first.id, meetinginterval_id: Meetinginterval.first.id}]) | ||
users.first.wishes.create([{available_offline: false, available_online: true, goal: 'Code really well in Python', programminglanguage_id: Programminglanguage.first.id, meetinginterval_id: Meetinginterval.second.id}]) | ||
|
||
p "Created #{ApiUser.count} api_user entries" | ||
p "Created #{Meetinginterval.count} meeting interval entries" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.