I have a list of books categories on my db. I can get the value of them inside my controller like this:
@categories = Book.uniq.pluck(:category) #programming, networking, infrastructure
And then, I can pass the value in the view to a drop down menu like this:
<%= s.select :category, options_for_select(@categories) %>
So, my question:
How I can define to be the selected default value of my drop down menu, the second value of the @categories
?