Hi I have the code def index @messages = message_thread.messages end private def message_thread begin current_user.message_threads.find(params[:thread_id]) rescue ActiveRecord::RecordNotFound logger.warn "No permission or thread_id nil" render :file => "#{RAILS_ROOT}/public/404.html" end end And even if params[:id] does not have any values I dont get any exception . I can''t figureout why. Please help Thanks -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/8/25 Tom Mac <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Hi > I have the code > > def index > @messages = message_thread.messages > end > > private > > def message_thread > begin > current_user.message_threads.find(params[:thread_id]) > rescue ActiveRecord::RecordNotFound >The problem is here:> logger.warn "No permission or thread_id nil" > render :file => "#{RAILS_ROOT}/public/404.html" > end > end > > > And even if params[:id] does not have any values I dont get any > exception . I can''t figureout why. Please help >You have a rescue statement which is overriding the exception: current_user.message_threads.find(params[:thread_id]) rescue ActiveRecord::RecordNotFound remove the rescue first you will see an exception.> > Thanks >--- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *"Many people doubt open source software and probably don’t realize that there is an alternative… which is just as good.." -- Kevin Scannell* -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Edmond Thanks for your reply. The problem is not that. Even it enters in rescue, it does not render :file => "#{RAILS_ROOT}/public/404.html". But it continues execution and I get problem at @messages = message_thread.messages as nil.messages Thanks Tom -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.