This works, however is there a way to do this globally or do I have to
entered this for every action that could error in this way? I understand
about using routes to narrow down what URL’s can be typed, but this does
not escape an error when a value entered is incorrect.
Incidentally, I looked at the Typo code and could not see any error
checking, not a rescue in sight. How do they do it in typo?
flash[‘errors’] = “That project cannot be edited.”
This works, however is there a way to do this globally or do I have to
entered this for every action that could error in this way? I
understand
about using routes to narrow down what URL’s can be typed, but this
does
not escape an error when a value entered is incorrect.
You could have a before_filter call a function that tests that the id
in your URL is valid. If you also want to verify that the right
person is attempting to edit it… you could do that there as well.
Hope that helps.
Cheers,
-Robby
Robby R.
Founder & Executive Director
PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting
Implement the ‘rescue_action_in_public’ method in your controller (or in
application.rb) to define behavior based on a common exception. You
could
display a 404, or whatever you want.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.