Nope - sorry - this doesn't work either.
I will have to do some more digging about I think. THanks anyway... On 5 Dec, 18:10, Rick DeNatale <[email protected]> wrote: > On Sat, Dec 5, 2009 at 12:54 PM, RubyonRails_newbie > > <[email protected]> wrote: > > Ive since updated my controller to :id > > > THe posts delete fine, until there are no posts left for that id to > > delete, then I get the error: > > Showing app/views/user/index.html.erb where line #40 raised: > > > Called id for nil, which would mistakenly be 4 -- if you really wanted > > the id of nil, use object_id > > > I need an if posts.exists? or someting similar to allow the page to > > render regardless of the number of posts... > > @post.destroy if @post > > -- > Rick DeNatale > > Blog:http://talklikeaduck.denhaven2.com/ > Twitter:http://twitter.com/RickDeNatale > WWR:http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn:http://www.linkedin.com/in/rickdenatale -- 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.

