欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

《五》更多模型

程序员文章站 2024-03-11 16:01:07
...
[list]
[step
jruby script/generate model Customer
jruby script/generate model Order
jruby script/generate model OrderLine
jruby script/generate model User

jruby -S rake db:migrate


(in /home/xia/worktest/shoplet)
rake aborted!
An error has occurred, all later migrations canceled:

Table users does not exist
解决办法 把 User class 移到外边来

class User < ActiveRecord::Base;end

class CreateUsers < ActiveRecord::Migration

def self.up
create_table :users do |t|
t.column :username, :string
t.column :password, :string
end
User.create :username=> 'admin',:password=> 'admin'
end



jruby -S rake db:migrate RAILS_ENV=test

manager user


1 :
jruby script/generate scaffold User
jruby script/generate scaffold Order

]
[/list]