-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.rb
43 lines (36 loc) · 940 Bytes
/
category.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Class: Category
#
# Models our Category objects that help further define our
# products.
#
# Attributes:
# @id - Integer: Primary Key related to the categories table of db.
# @name - String: Name given to Category
# @description - String: Describes the category
#
# Public Methods:
# #list_products_belonging_to
# .requirements
class Category
include DatabaseMethods
attr_accessor :name, :description, :id
def initialize(options)
@name = options["name"]
@description = options["description"]
@id = options["id"]
end
# def list_products_belonging_to
# DATABASE.execute("SELECT name FROM products WHERE category_id = #{@id}")
# end
# Public: .requirements
# Class method that returns the instance methods of a Category item minus @id.
#
# Returns:
# Array
#
# State Changes:
# None
def self.requirements
requirements = ["name", "description"]
end
end