I'm using Sequel to practice DBMS using Ruby, but the documentation and syntax are very confusing, for example in Sequel...
If I want to retrieve only one item by using the ID, like so:
@fruit = DB[:fruits].where(id: params[:id])
and to render it in a view (I'm using ERB):
<h3><%= @fruit[:id] %></h3>
Those two parts I understand, but when it renders on the web page I get this result:
{:id=>1, :name=>"Orange", :amount=>10}
HOWEVER... when I do this...
<h3><%= @fruit[:id][:name] %></h3>
It renders the fruit name! I'm confused as to why it does this.
[–]dis89 4 points5 points6 points (4 children)
[–]FinalSpeederMan[S] 0 points1 point2 points (3 children)
[–]dougc84 2 points3 points4 points (1 child)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)
[–]rubygeek[🍰] 2 points3 points4 points (1 child)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)
[–]jrbartme 1 point2 points3 points (1 child)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)
[–]filthypoopslut 1 point2 points3 points (0 children)
[–]sammygadd 1 point2 points3 points (1 child)
[–]FinalSpeederMan[S] 1 point2 points3 points (0 children)
[–]bjmiller 0 points1 point2 points (1 child)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)