I'm trying to create a page with a series of checkboxes on it for which the text associated with them will be pulled from a database. The view on which the form should be is named keyword_search and is located within the searches folder. The below is the code I've used to try and create the checkboxes in the view:
<% @topic.each do |degree| %>
<form action="recommender_results.html.erb" method="get">
<input type="checkbox" name="topic" value="topic"><%= recommend.topic %><br>
</form>
And below is the code I have within the searches contrller:
def new
@topic = Recommend.new
end
def keyword_search
@topic = Recommend.all.select(:topic)
end
Aucun commentaire:
Enregistrer un commentaire