I’m using the sequel gem in Ruby to connect to a sqlite database (provided by rails). I have various Users and various Projects. I want to find the unique project object user.username/project.name, if it exists. What’s the most elegant way of doing this? I have the connection working etc. I have:
DB = Sequel.connect 'sqlite:///path/to/sqlite'
class User < Sequel::Model
end
class Project < Sequel::Model
end
# How do I retrieve the project object using project_name, user_name
# project.name == project_name
# project.user_id = xxx
# and there is a user with id xxx and username user_name?
Assuming you have the
project_nameanduser_nameand want to do a join and find the project that matches both: