I am using Sinatra and Sequel with PostgreSQL.
After authentication, I want to welcome the user by printing their name but I cannot get only the value of the user's name from the database, it comes out as a hash.
The query is:
current_user = DB[:users].select(:username).where('password = ?', password).first
and the resulting piece of data is:
Welcome, {:username=>"Rich"}
which looks rather weird, I would prefer it to read "Welcome, Rich".
What am I doing wrong here? I tried the same query without 'first" at the end and that does not work either.
current_user[:username]
. – PlacidaDB["some query"]
. You're missing the power of Sequel and ORMs when you do that. Read the Sequel cheat sheet for a quick overview of how it's supposed to be used. – Pamella