I am trying to add a featured post feature to my Ruby on Rails Blog. So far I have added a featured_post
column to my post
table and it passes a 1
if the check box is selected and 0
if not.
Now I am attempting to pull out these posts by doing the following:
/views/posts/index.html.erb
<% @featured_post.each do |post| %>
<%= post.title %>
<% end %>
And in the posts_controller.rb I am doing the following in the index
action:
@featured_post = Post.all
Obviously this brings in all the post titles which is not what I want. I am assuming I have to add something to the controller to all for this but not sure what that is.