Ruby - model.rb:20: syntax error, unexpected keyword_end, expecting $end
- by Yasir Adnan
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??