Skip to content

Instantly share code, notes, and snippets.

@gitDbits
Last active March 14, 2021 13:51
Show Gist options
  • Save gitDbits/fcfc6d44cde21b537297f9a10d742abd to your computer and use it in GitHub Desktop.
Save gitDbits/fcfc6d44cde21b537297f9a10d742abd to your computer and use it in GitHub Desktop.
begin
@lesson = Lesson.find(params[:id]) if current_user
@lesson = Lesson.by_teacher(current_teacher).find(params[:id]) if current_teacher
rescue ActiveRecord::RecordNotFound => e
redirect_to lessons_path, flash: { warning: "Impossible localized record" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment