if <condition>
  render '/404.html'
  return
end

Quoting Legato <sire...@gmail.com>:
> I can't raise ActiveRecord::NotFound as that's not the ORM I am using,
> so it is not even require'd in my project.  Rendering 404.html should
> work, but how do I halt the action additionally?  raising an Exception
> will prevent the rest of the action from executing, but rendering
> won't afaik.
> 
> On Jun 3, 4:43 am, "Jeffrey L. Taylor" <r...@abluz.dyndns.org> wrote:
> > Try "raise ActiveRecord::NotFound" or "render '/404.html'".
> >
> > Jeffrey
> >
> > Quoting Legato <sire...@gmail.com>:
> >
> > > What does one do when he's not using ActiveRecord?  (Sequel here.)
> >
> > > On Jun 1, 10:02 am, "Jeffrey L. Taylor" <r...@abluz.dyndns.org> wrote:
> > > > Raising.  In Rails 1.x and 2.x, ActiveRecord:NotFound exception is 
> > > > caught by
> > > > Rails and it displays the404page.
> >
> > > > HTH,
> > > >   Jeffrey
> >
> > > > Quoting Mirko <batam...@gmail.com>:
> >
> > > > > Do you mean rescuing or raising ActiveRecord::NotFound?
> >
> > > > > On Jun 1, 4:54 am, "Jeffrey L. Taylor" <r...@abluz.dyndns.org> wrote:
> > > > > > Quoting Joshua Partogi <joshua.part...@gmail.com>:
> >
> > > > > > > Hi all,
> >
> > > > > > > I want to be able to display404page from a controller when a 
> > > > > > > record
> > > > > > > in the database can not be found. I am using Rails 3 at the 
> > > > > > > moment. I
> > > > > > > tried to find how to do this on guides.rails.info with no luck. 
> > > > > > > Can
> > > > > > > anybody recommend the best approach to do this?
> >
> > > > > > Have you tried raising ActiveRecord::NotFound in the controller?  
> > > > > > Or just let
> > > > > > the model raise it.
> >
> > > > > > Jeffrey
> >
> > > > > > P.S. not actually tried this in Rails 3, this works for me in Rails 
> > > > > > 1.x and
> > > > > > 2.x.
> >
> > > --
> > > 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-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
> 
> -- 
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to