【文件属性】:
文件名称:Poseidon:使用 Rack 和 ActiveRecord ORM 的迷你 MVC Web 框架
文件大小:156KB
文件格式:ZIP
更新时间:2021-06-17 03:29:33
Ruby
波塞冬
Poseidon 是一个非常简单的示例机架应用程序,可帮助您了解如何使用基于中间件的 MVC 模式和活动记录构建自己的机架应用程序
创建迁移:
rake db:new_migration name=Posts
编辑迁移:
class Posts < ActiveRecord::Migration
def up
create_table :posts do |t|
t.string :title
t.string :body
t.timestamps
end
end
创建模型:
模型/post.rb
class Post < ActiveRecord::Base
end
创建控制器:
控制器/post_controller.rb
class PostController
【文件预览】:
Poseidon-master
----public()
--------js()
--------fonts()
--------css()
----config.ru(1KB)
----views()
--------post()
--------show.html.erb(60B)
--------application.html.erb(794B)
--------user()
----db()
--------config.yml(93B)
--------seed.rb(224B)
--------migrate()
----models()
--------post.rb(342B)
--------user.rb(55B)
----controllers()
--------application_controller.rb(165B)
--------post_controller.rb(846B)
--------user_controller.rb(112B)
----boot.rb(642B)
----lib()
--------helpers.rb(1KB)
--------router.rb(1KB)
--------application.rb(285B)
--------dispatcher.rb(1KB)
--------request.rb(284B)
--------filters.rb(2KB)
--------view.rb(432B)
--------controller.rb(2KB)
--------middlewares.rb(720B)
--------response.rb(208B)
----Gemfile(231B)
----console.sh(39B)
----Rakefile(70B)
----config()
--------routes.rb(174B)
----console.rb(257B)
----README.md(1KB)
----Gemfile.lock(2KB)
----.gitignore(65B)