active_post is set as 'tinyint'. What is currently happening is that I hit 'delete'.
The active_post column is set to 0, but the post is still visible on the front end. In short - I only want the active post to be visible to the user. If the delete it, it is archived, and no posts visible, until they add a new one - so a user should only ever have 1 active post. Hope this makes sense? Is there a way I can do this? On 8 Dec, 21:08, Colin Law <[email protected]> wrote: > 2009/12/8 RubyonRails_newbie <[email protected]>: > > > Hi Colin, > > > :conditions active_post is meant to only display posts that are > > active. > > > If a user deletes a post (they think it's deleted, but infact it is > > archived and just set as inactive) as I may want to do something with > > it at a later date on the site. > > > I looked on the rails api site, I was therefore kinda hoping that : > > > Post.find_by_user_id( session[:user_id], 1, :limit => > > 1, :conditions => "active_post = 1", :order => "created_at desc") > > would only return posts where the active flag is set to 1. > > I would kinda hope that would happen too. What did happen? > > Is active_post an integer type column or a string? If it is a string > then "active_post = '1'" might be better as integer 1 is not the same > as string '1' > > 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.

