SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simply rails 2-compiler error

    I entered this into the rails console-class Story < ActiveRecord::Base; end
    and got compiler error message, this is on page 103...whats up?

  2. #2
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    can you post the details of the error message you're getting?

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    syntax error:compile error
    (irb):1: class/module name must be constant
    (irb):1: syntax error, unexpected kend expecting '\n' or ';'

  4. #4
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are you sure that the code you posted is exactly what you entered?

    e.g.
    Code Ruby:
    class Story < ActiveRecord::Base; end

    The first error (class/module name must be CONSTANT) means that the name you give to a class when declaring it should be a Ruby constant. In ruby, constants must be named starting with a capital letter. So you'd most likely get that error if you tried to say "class story" instead of "class Story".

    The second error (unexpected kEND) happens when the ruby interpreter comes to an "end" keyword that it wasn't expecting, here that could be because you omitted the semi-colon in the code you entered.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •