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.

Revisions

  1. __mifflin__ revised this gist Oct 19, 2018. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion rails_errors_and_fixes.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,18 @@
    Error: RecordNotFound Couldn't find User with 'id'="

    Fix: as outlined on [so](https://stackoverflow.com/a/44704987)

    ```ruby
    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
    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](https://stackoverflow.com/a/37372219)

    In Heroku console: `rake run db:schema:load`
  2. __mifflin__ created this gist Oct 19, 2018.
    13 changes: 13 additions & 0 deletions rails_errors_and_fixes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    Error: RecordNotFound Couldn't find User with 'id'="
    Fix: as outlined on [so](https://stackoverflow.com/a/44704987)
    ```ruby
    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](https://stackoverflow.com/a/37372219)
    In Heroku console: `rake run db:schema:load`