-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.rb
32 lines (32 loc) · 860 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
class Category
@loc_cat = "categories"
extend Logic
#add a new category
# def self.add(name)
# DATABASE.execute("INSERT INTO categories (name) VALUES ('#{name}')")
# end
#
# #list al categories
# def self.list_cats
# DATABASE.execute("SELECT * FROM categories")
# end
#
# #list individual category by id
# def self.list_cat(value)
# DATABASE.execute("SELECT * FROM categories WHERE id = #{value}")
# end
#
# #delete a category by id or name
# def self.delete(value)
# if value.is_a?(Integer)
# DATABASE.execute("DELETE FROM categories WHERE id = #{value}")
# else
# DATABASE.execute("DELETE FROM categories WHERE name = '#{value}'")
# end
# end
#
# #update a category name by id
# def self.update(name,id)
# DATABASE.execute("UPDATE categories SET name = '#{name}' WHERE id = #{id}")
# end
end