创建rails工程
[root@localhost work]# rails new demo
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
......
[root@localhost work]# cd demo/
[root@localhost demo]# rake db:create RAILS_ENV='development'
Could not find rdoc-3.12.2 in any of the sources
Run `bundle install` to install missing gems.
[root@localhost demo]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.
Fetching source index from https://ruby.taobao.org/
.......
[root@localhost demo]# bundle update
Fetching source index from https://ruby.taobao.org/
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.6.1
Using multi_json 1.11.0
Using activesupport 3.2.13
Using builder 3.0.4
.....
[root@localhost demo]# rails g scaffold student name:string age:integer grade:integer
invoke active_record
create db/migrate/20150304093405_create_students.rb
create app/models/student.rb
invoke test_unit
create test/unit/student_test.rb
create test/fixtures/students.yml
invoke resource_route
route resources :students
invoke scaffold_controller
create app/controllers/students_controller.rb
invoke erb
........
[root@localhost demo]# rake db:migrate RAILS_ENV='development'
== CreateStudents: migrating =================================================
-- create_table(:students)
-> 0.0174s
== CreateStudents: migrated (0.0176s) ========================================
[root@localhost demo]# rails s -p80
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:80
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-03-04 17:37:56] INFO WEBrick 1.3.1
[2015-03-04 17:37:56] INFO ruby 2.0.0 (2014-11-13) [x86_64-linux]
.......
[root@localhost demo]# bundle update
Fetching source index from https://ruby.taobao.org/
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.6.1
Using multi_json 1.11.0
Using activesupport 3.2.13
Using builder 3.0.4
.....
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY