2009/12/9 RubyonRails_newbie <[email protected]>: > Colin, > > Before I debug.... I have had an idea: > > What about the view? > > If I can write a decent if statement to only return active_posts that > = 1 I should be good to go. I did try this today, but it still showed > the inactive post when I set it to 0.. > > Here's what I wrote - There's maybe a better (correct way) to do it... > > <% if @posts.active_post = 1 %>
That should be == 1 > > <% render :partial => posts %> > > > > <% end %> > > <% if @posts.active_post != 1 %> You can use <% else %> rather then end and another if > > There are no posts! > > <% end %> > > > > Sadly this didn’t work, but I wondered if anyone knew why? I can > delete a post, setting the 1 value to a 0, but the post still remains > in the view… If still not working put in your view some debug: <p>posts active_post value is <%= @posts.active_post %></p> But you would be better off debugging the controller first to check that the query is working correctly. Did you look in development.log to see exactly what query is being run? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

