Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ gem "sinatra-activerecord"
gem "sqlite3"
gem "pry"
gem "require_all"
gem "rake"
gem "activerecord"
72 changes: 37 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (6.0.3.1)
activesupport (= 6.0.3.1)
activerecord (6.0.3.1)
activemodel (= 6.0.3.1)
activesupport (= 6.0.3.1)
activesupport (6.0.3.1)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activesupport (6.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
coderay (1.1.1)
concurrent-ruby (1.1.6)
i18n (1.8.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
coderay (1.1.3)
concurrent-ruby (1.1.8)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
method_source (0.8.2)
minitest (5.14.1)
mustermann (1.0.3)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
method_source (1.0.0)
minitest (5.14.3)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.3)
rack-protection (2.0.7)
rack-protection (2.1.0)
rack
require_all (1.3.3)
sinatra (2.0.7)
rake (13.0.3)
require_all (3.0.0)
ruby2_keywords (0.0.4)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.7)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
sinatra-activerecord (2.0.12)
activerecord (>= 3.2)
sinatra-activerecord (2.0.22)
activerecord (>= 4.1)
sinatra (>= 1.0)
slop (3.6.0)
sqlite3 (1.3.13)
thread_safe (0.3.6)
sqlite3 (1.4.2)
tilt (2.0.10)
tzinfo (1.2.7)
thread_safe (~> 0.1)
zeitwerk (2.3.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
zeitwerk (2.4.2)

PLATFORMS
ruby
x86_64-darwin-20

DEPENDENCIES
activerecord
pry
rake
require_all
sinatra-activerecord
sqlite3

BUNDLED WITH
1.14.6
2.2.6
3 changes: 3 additions & 0 deletions bin/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@



binding.pry
puts "HELLO WORLD"


1 change: 1 addition & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/development.db')
require_all 'lib'

54 changes: 54 additions & 0 deletions lib/Employee.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Employee
#name, id, project_id
attr_accessor :id, :name, :employeer, :project_id
@@all = []

def initalize(id = nil, name, employeer) #, project_id = nil)
@id=id
@name = name
# @project_id = project_id
@employeer = employeer
@@all << self
end


def self.all
@@all
end

#basic save method to add new record into database using sql. Note requires .update method
# def save
# if self.id
# self.update
# else
# sql = <<-SQL
# INSERT INTO employee (name, project_id, employeer_id)
# VALUES (?, ?, ?)
# SQL

# DB[:conn].execute(sql, self.name, self.project_id,employeer_id)
# @id = DB[:conn].execute("SELECT last_insert_rowid() FROM songs")[0][0]
# end
# end

# #create new instance method
# def self.create(name, employeer, project_id=Nil)
# employee = Employee.new(name, employeer.id)
# employee.save
# employee
# end

# def self.find_by_id(id)
# sql = "SELECT * FROM employee WHERE id = ?"
# result = DB[:conn].execute(sql, id)[0]
# Employee.new(result[0], result[1], result[2])
# end

# def update
# sql = "UPDATE employee SET name = ?, employeer_id = ?, project_id, WHERE id = ?"
# DB[:conn].execute(sql, self.name, self.employeer_id, self.project_id self.id)
# end


end

32 changes: 32 additions & 0 deletions lib/EmployeeSkills.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class EmployeeSkills
attr_accessor :id, :employee_id, :skill_id
@@all =[]

def initalize(id=nil, employee_id, skill_id)
@id = id
@employee_id = employee_id
@skill_id = skill_id
@@all << self
end

def self.all
@@all
end

















end
17 changes: 17 additions & 0 deletions lib/Employeer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Employeer
attr_accessor :id, :name

@@all = []

def initalize (id=nil,name)
@id=id
@name = name
@@all << self
end


def self.all
@@all
end

end
18 changes: 18 additions & 0 deletions lib/Project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Project
#name, id
attr_accessor :id, :project
@@all = []

def initalize(id=nil,project)
@id=id
@project = project
@@all << self
end



def self.all
@@all
end

end
17 changes: 17 additions & 0 deletions lib/ProjectSkills.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ProjectSkills
attr_accessor :id, :project_id, :skill_id

@@all=[]

def initalize(id=nil,project_id,skill_id)
@id=id
@project_id=project_id
@skill_id=skill_id
@@all<<self
end

def self.all
@@all
end

end
16 changes: 16 additions & 0 deletions lib/Skill.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Skill
#id, name
@@all = []

attr_accessor :id, :name
def initalize(id=nil, name)
@id = id
@name = name
@@all << self
end

def self.all
@@all
end

end
4 changes: 4 additions & 0 deletions lib/Temp_data_load.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# employee1 = Employee.new("Bob")
# employee2 = Employee.new("Jim")

# project1 = Project.new("Build Ruby App")