一佳一

记录像1+1一样简洁的代码

导航

padrino MVC项目

Posted on 2022-07-31 17:13  一佳一  阅读(19)  评论(0编辑  收藏  举报

创建项目
padrino g project demo_project -e liquid -s jquery -d sequel -a postgres -c scss

生成
bundler install

启动测试
padrino s

修改数据库链接
Sequel.connect("postgres://192.168.0.230/test?user=postgres&password=123456", :loggers => [logger])

创建管理后台
padrino g controller Admin get:index get:new post:create

创建实体
padrino g model User

修改实体文件 db/migration
padrino g migration AddFieldsToUsers last_login:datetime crypted_password:string name:string age:integer email:string

执行迁移文件
rake sq:migrate:auto # Perform automigration (reset your db data)
rake sq:migrate:to[version] # Perform migration up/down to VERSION
rake sq:migrate:up # Perform migration up to latest migration available
rake sq:migrate:down # Perform migration down (erase all data)
rake sq:reset

生成控制器
padrino g controller user get:index get:show