Skip to content

NoMethodError: undefined method `id' for nil:NilClass #270

@dslusser

Description

@dslusser

Hello,

First of all I wanted to say that I love this lti_starter_app template, I'm working through some of the related YouTube tutorial videos on this template and they're proving very helpful; thank you so much for all of this content. Right now I appear to be at an impasse with an error in the code that won't allow me to proceed. I seem to be stuck at the database creation when I run rake db:setup and/or rake db:seed

When the script gets to the point of seeding the application instances, I run into this error:

CREATED ADMIN USER: admin@example.com *** Seeding Sites *** Creating site: https://localhost:3000/ *** Seeding Applications *** Creating application: LTI Admin *** Seeding Application Instances *** rake aborted! NoMethodError: undefined method ``id' for nil:NilClass /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:135:in ``block in setup_application_instances' /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:133:in ``each' /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:133:in ``setup_application_instances' /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:196:in ``block in <top (required)>' /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:187:in ``each' /Users/Dan/Documents_Local/devlocal/canvas/atomic_jolt/LTI_Starter/LTI-SAKs/lti_saks_4/db/seeds.rb:187:in ``<top (required)>' Tasks: TOP => db:setup => db:seed (See full trace by running task with --trace)

It seems to me that the main issue is traced to attrs = attrs.merge(site_id: site.id) on line number 135. I'm not sure that site_id is defined in the template initially, and any attempts to give it a numerical value in various ways (hard coding it in the seeds.rb, defining in the secrets.yml and in .env) have failed. Would someone be able to guide me to a solution for this error? Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions