added viewing all assistants
This commit is contained in:
parent
6c27feb9e7
commit
a80ba5bfe0
3 changed files with 46 additions and 9 deletions
|
|
@ -1,24 +1,24 @@
|
|||
# app/models/assistant.rb
|
||||
# models/assistant.rb
|
||||
require 'sequel'
|
||||
|
||||
class Assistant < Sequel::Model
|
||||
# This model assumes your assistants table has these columns:
|
||||
# id (primary key), name, description, created_at, updated_at
|
||||
|
||||
|
||||
# If you have a different schema, modify the column names accordingly
|
||||
|
||||
|
||||
# Optional: Add validations
|
||||
def validate
|
||||
super
|
||||
errors.add(:name, 'must be present') if name.nil? || name.empty?
|
||||
end
|
||||
|
||||
|
||||
# Optional: Add custom methods for common operations
|
||||
def self.find_by_name(name)
|
||||
where(name: name).first
|
||||
end
|
||||
|
||||
|
||||
def self.active
|
||||
where(active: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue