Ruby - model.rb:20: syntax error, unexpected keyword_end, expecting $end

Posted by Yasir Adnan on Stack Overflow See other posts from Stack Overflow or by Yasir Adnan
Published on 2012-10-26T04:54:03Z Indexed on 2012/10/26 5:00 UTC
Read the original article Hit count: 241

Filed under:

I don't understand what's wrong with my code.

model.rb

require 'Gemfile'

DataMapper.setup(:default, 'mysql://root:password@localhost/rengine')
Class User
    include DataMapper::Resource

    property :id,         Serial    # An auto-increment integer key
    property :email,      String,    format: :email_address
    property :username,   String,    required: true  
    property :password,   String ,   length: 10..255, required: true  
    property :created_at, DateTime 
    property :updated_at, DateTime 
    #User can have mutiple posts
    has n, :posts
end

Class Post
    include DataMapper::Resource

    property :id,         Serial    # An auto-increment integer key
    property :title,      String,    required: true  
    property :body,       Text,      required: true  
    property :created_at, DateTime  
    property :updated_at, DateTime 

    #Posts belongs to a USer
    belongs_to :user

end

DataMapper.auto_upgrade!

I didn't able to figure out. What's problem is here??

© Stack Overflow or respective owner

Related posts about ruby