This question already has an answer here:
So I'm learning programming in general, and Ruby specifically; in the course we are developing an app like rottentomatoes.
I need to query the model from the controller, to render in the view the distinct values in that specific column.
I have this piece of haml to embed the result on the template:
= form_tag movies_path, :method => :get do
Include:
- @all_ratings.each do |rating|
= rating
= check_box_tag "ratings[#{rating}]"
= submit_tag 'Refresh'
I have @all_ratings
in the controller, I have tried movie[attr_rating]
, Movie(:rating)
... And I don't know what else to throw to it.
I do not want to hardcode the values (['G','PG','PG-13','R']
) in the controller, but learn how to query the model.
Aucun commentaire:
Enregistrer un commentaire