- 浏览: 1309067 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (732)
- Java_about (146)
- Spring_Hibernate_Struts_OpenSource (27)
- linux_unix (62)
- life_sth (22)
- js_css_html_xml_nodejs (69)
- design_pattens (1)
- Perl (8)
- php_ecshop (4)
- DB_Mysql_Oracle_Informix_SqlServer (43)
- JSTL (8)
- Testing_自动化测试 (42)
- DB_ID_UUID (4)
- SEM_SEO (1)
- english_study_improvement (4)
- SVN_Git (9)
- WebService_SOA_CloudComputing (3)
- E-Commerce (1)
- Lucene_Solr (7)
- others (2)
- Regex (2)
- tomcat_jetty (8)
- zeroc-ice (1)
- java_excel (5)
- ant_maven_gradle (5)
- Unity_VR_AR_C# (2)
- jmeter (1)
- XPath_dom4j (1)
- Ruby_and_Rails (68)
- write_a_rails (17)
- manage_and_team (1)
- getting_real (1)
- ubuntu (20)
- git_and_git_flow (7)
- TODO (1)
- PM_design (2)
- Python_and_Django (8)
- NoSql_mongo_redis (24)
- C/C++ (3)
- vi_vim_gvim (0)
- c#_.Net_windows编程_dll (10)
- Php_and_Yii (9)
- Android_IOS (31)
- Mysql (5)
- sa_运维_network_硬件 (37)
- lua (2)
- c_cpp_VisualStudio (21)
- 硬件-RM-Arduino (6)
最新评论
-
shenkun58:
...
NoClassDefFoundError: Could not initialize springframework.BeanCreationException -
liaojia1:
正解,感谢
NoClassDefFoundError: Could not initialize springframework.BeanCreationException -
flingfox63:
谢谢分享,电脑上有IPV6,导致了Guard启动不了……
ruby错误解决: Address family not supported by protocol - connect(2) -
c39274936:
s = "hello_world_ruby" ...
驼峰格式和下划线格式转换_translation between camel and snake format -
yfj300:
学习了学习了学习了学习了
硬盘基本知识(磁道、扇区、柱面、磁头数、簇、MBR、DBR)
周末看书,总想试验一把,可总不能跑到公司去吧~
所以,还得在win下安装一下ruby on rails
基本上按照这个步骤参考为http://rubyonrails.org/download
#1 安装ruby
1.8.7
#2 安装gem(好像1.9之后不用此步骤了)
1.8.5(公司用的1.3.7)
结果gem的1.8.5版本和rails2.3.8不兼容,下一篇写写gem的事情
#3 安装rails
2.3.8
D:\>gem install rails -v 2.3.8
Fetching: rake-0.9.2.gem (100%)
Fetching: activesupport-2.3.8.gem (100%)
Fetching: activerecord-2.3.8.gem (100%)
Fetching: rack-1.1.2.gem (100%)
Fetching: actionpack-2.3.8.gem (100%)
Fetching: actionmailer-2.3.8.gem (100%)
Fetching: activeresource-2.3.8.gem (100%)
Fetching: rails-2.3.8.gem (100%)
Successfully installed rake-0.9.2
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.2
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
8 gems installed
Installing ri documentation for rake-0.9.2...
Installing ri documentation for activesupport-2.3.8...
Installing ri documentation for activerecord-2.3.8...
Installing ri documentation for rack-1.1.2...
Installing ri documentation for actionpack-2.3.8...
Installing ri documentation for actionmailer-2.3.8...
Installing ri documentation for activeresource-2.3.8...
Installing ri documentation for rails-2.3.8...
Installing RDoc documentation for rake-0.9.2...
Installing RDoc documentation for activesupport-2.3.8...
Installing RDoc documentation for activerecord-2.3.8...
Installing RDoc documentation for rack-1.1.2...
Installing RDoc documentation for actionpack-2.3.8...
Installing RDoc documentation for actionmailer-2.3.8...
Installing RDoc documentation for activeresource-2.3.8...
Installing RDoc documentation for rails-2.3.8...
测试安装成功否:
D:\>rails -v
Rails 2.3.8
其他的包也大致安装吧。
#4 创建一个helloapp
1)装mysql数据库
2)生成一个database
mysql> create database hello;
3)安装mysql的gem包
D:\>gem install mysql
4)生成一个rails app
D:\workruby>rails helloapp
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create test/fixtures
create test/functional
create test/integration
create test/performance
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create Rakefile
create README
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create config/database.yml
create config/routes.rb
create config/locales/en.yml
create db/seeds.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_rails_defaults.rb
create config/initializers/session_store.rb
create config/initializers/cookie_verification_secret.rb
create config/environment.rb
create config/boot.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/console
create script/dbconsole
create script/destroy
create script/generate
create script/runner
create script/server
create script/plugin
create script/performance/benchmarker
create script/performance/profiler
create test/test_helper.rb
create test/performance/browsing_test.rb
create public/404.html
create public/422.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
5)配置rails连接数据库
config/database.yml文件
此处为了简单测试,把test和production都配置成了一个,实际的项目应该分开~
development:
adapter: mysql
database: hello
pool: 5
timeout: 5000
username: root
password: fantaxy
host: localhost
# 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: hello
pool: 5
timeout: 5000
username: root
password:
fantaxy
host: localhost
production:
adapter: mysql
database: hello
pool: 5
timeout: 5000
username: root
password:
fantaxy
host: localhost
6)写ActionPack
#I 在app/controllers目录下新建一个文件hello_controller.rb
class HelloController < ApplicationController
def index
@name = "fantaxy"
@now = Time.new
end
end
#II 在app/views目录下新建文件夹hello
#III 在app/views/hello下新建一个view文件index.html.erb
<html>
<head>
<title>hello</title>
</head>
<body>
<p>Hello <%= @name %></p>
<p>It's now <%= @now.to_s(:db) %></p>
</body>
</html>
7)启动server
D:\workruby\helloapp>ruby script\server
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
8)观察结果
浏览器输入:http://localhost:3000
看见rails的欢迎界面。
可以点击 About your application’s environment 连接看下自己主机的环境
如果有错误,看下后台,比如没有安装mysql的gem包等,会有提示
浏览器输入:http://localhost:3000/hello
看见结果:
Hello fantaxy
It's now 2011-07-02 22:35:24
先到此吧。记得找个自己喜欢的ide比较方便。
X
X
X
-
X
X
X
发表评论
-
ruby计算平方和开方_n次方n次幂
2022-06-28 21:52 647= = = ruby计算平方和开方 3 ** 2#= ... -
Ruby发送HTTP请求
2015-07-21 18:06 1164Ruby使用HTTP协议发送请求的方法备忘。 好像这 ... -
invalid byte sequence in GBK”问题 invalid byte sequence in UTF-8”问题
2015-07-03 15:11 2855碰见错误: test.rb:8:in `ma ... -
Ruby1.9之字符串内编码和外编码
2015-07-02 17:52 1278这里的文章很不错的么:Rubyist http://ru ... -
DevKit介绍和安装in railsInstaller
2015-05-26 17:01 2633DevKit介绍和安装in railsInstaller ... -
Rails_migrations中使用mysql的bigint
2014-09-30 14:32 1006From:http://rubyer.me/blog/468 ... -
Rails外如何启动rails的类自动加载_activates autoloading using ActiveSupport 3.x
2016-06-22 12:08 652The following cod ... -
如何在rails里打开gem里面的类_为何有时候不生效
2014-09-02 21:55 954在rails里面打开某个gem的类,补充一下等等,也 ... -
ruby的加载机制和rails_自动加载机制_对比
2014-09-02 16:51 1587prefer:http://urbanautomat ... -
Rails源码阅读(13)rails中的autoload和ruby的autoload
2014-07-30 17:13 1960Rails源码阅读(13)rails中的autoload和 ... -
Rails中命名路由的区别***_url与***_path
2014-07-29 16:37 1085Rails中命名路由的区别***_url与***_path ... -
ruby_gem安装_切换指定不同的源
2014-07-20 18:09 1155from:http://www.hiceon.com/to ... -
Ruby 的文件操作_不断总结
2014-07-11 11:55 1189一、用文件和目 ... -
Rails源码阅读(12)叫Rails的模块module_Rails常量使用
2014-07-02 09:35 1085The module nams "Rail ... -
注册邮件中的链接无host
2014-05-19 14:47 634在注册邮件中用命名路由的xxx_url不起作用,导致注 ... -
每个命令都有bundle exec的麻烦
2014-04-18 17:33 1429问题: 每次都得搞这个东西bundle exec放在 ... -
关于favicon.ico的报错:RoutingError
2014-03-31 14:45 1965错误: ActionController::Routin ... -
rbenv_安装太慢_解决办法
2014-03-31 13:51 2188rvm做了很多“不为人知”的事情,而且做的太 ... -
配置sunspot tomcat结合sunspot_rails
2014-02-26 10:58 898这个sunspot的东西还是有不少缺点的。 ht ... -
RubyOrRails_使用技巧_收集
2013-11-09 14:39 1081#link_to not working in sc ...
相关推荐
Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zipRuby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zipRuby_on_...
### Redmine 搭建 Ruby_Ruby_on_Rails 项目管理系统的知识点 #### 一、基础知识与背景介绍 **Redmine** 是一个基于 Web 的项目管理和跟踪工具,它使用 Ruby on Rails(简称 ROR)框架构建而成。Redmine 的设计初衷...
### Ruby on Rails Guides v2 - Ruby on Rails 4.2.5 #### 一、重要概念及基础假设 - **重要概念**:本指南旨在帮助读者深入理解Ruby on Rails(以下简称Rails)4.2.5版本的核心功能与最佳实践。 - **基础假设**:...
### Web开发:深入理解Ruby on Rails #### 一、引言与概述 Ruby on Rails (简称Rails) 是一种用于Web开发的开源框架,基于Ruby语言。Rails的设计理念强调程序员的生产力和代码的简洁性,因此它成为了Ruby语言的...
Ruby on Rails Guide:是rails官方教程,本人为了大家学习查阅的方便,制成chm格式。就如同java doc的chm格式一样方便。
为了开始Ruby on Rails的开发工作,首先需要安装Ruby。根据文档中的描述,这里以Windows XP系统为例进行介绍: 1. **下载与安装** - 下载最新的Ruby安装包(此处为`ruby185-21.exe`),默认安装路径为`C:\ruby`,...
- 使用 `mkdir /opt/ruby_on_rails` 命令创建安装目录。 - 通过上传工具将软件包上传至 `/opt/ruby_on_rails` 目录下。 - 可以使用 `ll -h` 命令查看上传的文件列表。 #### 四、安装依赖包 ##### 离线安装 - 如果...
综上所述,Ruby on Rails的笔记内容涵盖了从安装Rails环境到创建和运行一个简单的Rails项目的基础知识,这些内容对于初学者来说是学习Rails框架的极好入门材料。通过对这些知识点的学习,初学者可以快速了解Rails的...
ruby_on_rails_创建一个博客项目.doc
《敏捷Web开发与Rails》第三版是一本深入探讨Ruby on Rails框架在敏捷软件开发方法论下的应用指南。本书由多位知名作者共同编写,包括Sam Ruby、Dave Thomas、David Heinemeier Hansson等,他们都是在Ruby社区内享有...
[Ruby_on_Rails][中文]_02._[Mac]_安裝Ruby_on_Rail_6.x
### Ruby on Rails 笔记知识点总结 #### 一、引言 在《Ruby on Rails笔记》中,作者陈刚分享了他在学习Ruby on Rails过程中的经验与心得。这份笔记不仅包含了作者的学习历程和个人体会,还汇集了他在学习过程中遇到...
Ruby on Rails,简称Rails,是基于Ruby编程语言的开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,旨在提高开发效率和可读性,同时强调“约定优于配置”的原则。Rails的核心理念是“开发应该是一种...
Ruby on Rails,简称Rails,是基于Ruby编程语言的一个开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,旨在提高开发效率和代码的可读性。Rails的核心理念是“约定优于配置”(Convention Over ...
[Ruby_on_Rails][中文]_03._[Windows]_安裝Ruby_on_Rail_6.x
[Ruby_on_Rails][中文][Rails_5.x]__03-2_._安裝不同版本的Rails與產生Rails_5.x版
本书从Ruby和Rails的历史讲起,以在Rails框架上克隆故事共享网站digg.com为例,详细讲述了Ruby和Rails的安装过程、框架组成部分、与AJAX和Web 2.0技术结合、安全措施、高级话题和扩展功能等。本书带领读者运用最新...
Ruby on Rails:部署Rails应用至Heroku.docx