Stuck on 3/7


#1

Having issues getting through this point. Have tried everything imaginable, seems so simple but I'm completely stuck. Somebody help please!

  1. Then in the Messages controller (app/controllers/messages_controller.rb), add an index action:

def index
@messages = Message.all
end


#2

Hi @gturner0316yahoo.com,

Your code looks fine to me. Could you post the error message you're getting and a link to the exercise you're on?


#3

here is the link https://www.codecademy.com/en/courses/learn-rails/lessons/one-model/exercises/one-model-controller?action=lesson_resume

Error message includes: Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
/var/lib/gems/2.0.0/gems/activerecord-4.1.1/lib/active_record/migration.rb:389:in `check_pending!': (ActiveRecord::PendingMigrationError)


#4

@gturner0316yahoo.com

PendingMigrationError

It looks to me like you need to run a database migration.

$ rake db:migrate

#5

Tried and then entered code. Did not work, am I missing something here? Very confused


#6

@zystvan

getting this error now:
app/controllers/messages_controller.rb:1: class/module name must be CONSTANT (SyntaxError)


#7

@gturner0316yahoo.com Could you copy/paste everything in that file (app/controllers/messages_controller.rb) into here so I can see the code causing that error please?


#8

@zystvan here it is. thanks for your help


#9

@gturner0316yahoo.com Remove the word index from line 1.


#10

@zystvan I tried and here is what I have now


#11

@gturner0316yahoo.com Press the Enter key after def index, @messages = Message.all, and the first end.


#12

@zystvan Thank you!!! It worked!


#13

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