rails step by step
来源:互联网 发布:一人一首成名曲网络篇 编辑:程序博客网 时间:2024/05/01 15:30
今天看了一下語言排行,看到ruby 下來玩了一下,就此記錄一下如何配置.
1.先要下載ruby安裝 ,http://www.ruby-lang.org
2.當然是安裝rails 了, 打命令行下行打 c:/>gem install rails 自動會遠程下載安裝.
3.新建項目吧 rails mybook,會產生一堆東東.
4.配置數據庫
development:
adapter: mysql
database: mybook
host: localhost
username: root
password: 123456
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: mybook
host: localhost
username: root
password: 123456
production:
adapter: mysql
database: mybook
host: localhost
username: root
password: 123456
就此說明一點 :後邊一定要空格的, 這個要注意喔,還有就是產生控制器,沒有配數據庫的話,老是不執行
控制器裡的動作.搞不明白,
5.新建控制器 ruby generate controller book,會在controller目錄產生book_controller.rb 這個
6.在book_controller.rb中創建一個方法 index
7.在view/book 下新建index.rhtml
index.rhtml:
<html>
<head>
<title>Rails</title>
</head>
<body>
<H1>Hello Rails </H1>
</body>
</html>
8.啟動服務器 ruby server
9. http://127.0.0.1:3000/book/
- rails step by step
- Rails配置使用jquery-fileupload-rails step by step
- Deploying Rails Applications: A Step-by-Step Guide
- NHibernate Step by Step
- OGRE step by step
- step by step
- MinGW Step by Step
- 大杂烩---Step by Step
- sphinx4 STEP BY STEP
- EJB step by step
- NHibernate Step by Step
- Django Step by Step
- Eclipse: Step by Step
- step by step
- ALE STEP BY STEP
- [Design]Step by Step
- Makefile step by step
- SSRS step by step
- 用于图形绘制的Javascript库jsDraw2D发布
- 关闭浏览器,清空SESSION
- ext + struts2 上传文件
- ASP.NET中插入Flash
- ActiveX コンポーネントはオブジェクトを作成できません。
- rails step by step
- 类之间的关系
- Flex Event 顺序
- 软件管理74条体会自我检查
- 为了下载而攒分
- 添加修改日志步骤
- 李鸿章十四首律诗
- C# 添加文字水印类
- C# 添加图片水印类