4. Movies I / Rails Associations II


#1

Hi all !
Is it normal that we have always the same screen on the right side . Shouldn’t we see the different APP element take place ? It was the same in the previous . Did I made something wrong ?


https://www.codecademy.com/courses/learn-rails/lessons/many-to-many/exercises/many-to-many-movies-i?action=lesson_resume


#2

Hi @slibre2,

I recommend doing an online search for errors like these. If you do that, you’ll see that you need to run this command in the terminal to fix the first one:

$ bundle exec rake db:migrate

For the second error, it means that a certain item doesn’t have a name column in the database, but you’re trying to access it anyway. See if you can find where you’re accessing something .name, then check if it should be .title or something else instead.


#3

Hi Zystvan ,
can I write this code bundle exec rake db:migrate at any moment of the process ?


#4

For the second problem (sorry to mix both) isn’it because there are precise term "first-name " “last_name” and not general term in the database “name” ?
Look in the database there are the good words .
Do you think I should replace ( or maybe add) .title or .name ?
error message Undefined Method name
link https://www.codecademy.com/courses/learn-rails/lessons/many-to-many/exercises/many-to-many-movies-ii?action=lesson_resume
code page


#5

can I write this code bundle exec rake db:migrate at any moment of the process ?

Yes, but most of the time there’s no reason to unless you’ve changed your db/migrate files.

isn’it because there are precise term "first-name " “last_name” and not general term in the database “name” ?

That might be it, but I don’t know what you’re calling .name on. Find that, then figure out which table in the database it belongs to (actors, movies, etc.), then look at what properties it does have that you need to use instead.


#6

.name ? There’s no .name method at all , isn’it ?

Is this part wrong ?
<%= @actors.each do |t|%>



<%= t.image %>

<%= t.first_name %>
<%= t.last_name %>


<%= t.bio %>


<% end %>

Secondly I don’t really understand the error mesage : undefined method `name’ for nil:NilClass
Nil in NilClass ? Where is Nil class in this page ?
https://www.codecademy.com/courses/learn-rails/lessons/many-to-many/exercises/many-to-many-movies-ii?action=lesson_resume
I d like to go through . Thanks Zystvan


#7

That’s correct, there’s no .name method, which is what the error undefined method \name’ for nil:NilClass` means. Go to the terminal for the exercise (black area with blinking white cursor), and run these commands:

$ cd ~/workspace/learn-rails-many-to-many/
$ grep -r "\.name"

Then copy/paste the output here, please.


#8

Here is the output :
https://www.codecademy.com/courses/learn-rails/lessons/many-to-many/exercises/many-to-many-movies-ii?action=lesson_resume


thanks for your help Zystvan !


#9

@slibre2 The dollar sign ($) only represents the bash prompt, you’re not supposed to actually type it. Could you do it again, and not type the $ this time please?


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.