Skip to content

Instantly share code, notes, and snippets.

@cdrani
Last active October 19, 2018 03:34
Show Gist options
  • Save cdrani/a55613ec735e2bc98b3b884758a6d23f to your computer and use it in GitHub Desktop.
Save cdrani/a55613ec735e2bc98b3b884758a6d23f to your computer and use it in GitHub Desktop.
Fixes for Errors I Have Come Across Using Rails

Error: RecordNotFound Couldn't find User with 'id'="

Fix: as outlined on so

def current_user
  @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
end

Error: Tables not found in heroku error, such as in the case

ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "events" does not exist

Fix: as outlined on so

In Heroku console: rake run db:schema:load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment