Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dslusser opened this issue Feb 12, 2019 · 2 comments
Open

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

dslusser opened this issue Feb 12, 2019 · 2 comments

Comments

@dslusser
Copy link

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: [email protected] *** 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!

@jbasdf
Copy link
Contributor

jbasdf commented Jul 22, 2019

It's possible that the site wasn't successfully created and so site.id was nil. Even in development we use a real URL - https://helloworld.atomicjolt.xyz. I wonder if using locahost:3000 fails validation.

@dslusser
Copy link
Author

Thanks for the response Justin. If my memory serves me, I had some trouble setting up a proper URL in my development space so I left it as localhost. Whenever I get some free time I'll give it another go and try to use a proper URL, then update the thread here on the status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants