- 浏览: 47682 次
- 性别:
- 来自: 杭州
最新评论
开始rails之旅
1,创建应用
D:\ror>rails new myapp
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/mailers
create app/models
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/fixtures
create test/functional
create test/integration
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep
2,启动服务
D:\ror>cd myapp
D:\ror\myapp>rails server
Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
---回过头来想想,下面的步骤或许都不需要,只要运行下bundle install就行了(未验证)
3,安装sqlite3-ruby
D:\ror\myapp>gem install sqlite3-ruby
=============================================================================
You've installed the binary version of sqlite3-ruby.
It was built using SQLite3 version 3.6.23.1.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files where available
in the following download:
http://www.sqlite.org/sqlitedll-3_6_23_1.zip
You can put the sqlite3.dll available in this package in your Ruby bin
directory, for example C:\Ruby\bin
=============================================================================
Successfully installed sqlite3-ruby-1.3.1-x86-mingw32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.1-x86-mingw32...
Installing RDoc documentation for sqlite3-ruby-1.3.1-x86-mingw32...
4,再次启动服务,跳出一个错误框,见附件,提示
没有找到sqlite3.dll,因此这个应用程序未能启动,重新安装应用程序可能会解决这个问题
D:\ror\myapp>rails server
c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
from c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
from D:/ror/myapp/config/application.rb:7:in `<top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:28:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:28:in `block in <top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:27:in `tap'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
--不急,上面安装完sqlite3-ruby,有提示http://www.sqlite.org/sqlitedll-3_6_23_1.zip 下载获得sqlite3.dll,放到c:\ruby192\bin下。照做。
5,再次启动服务,成功
D:\ror\myapp>rails server
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-10-20 01:49:57] INFO WEBrick 1.3.1
[2010-10-20 01:49:57] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2010-10-20 01:49:57] INFO WEBrick::HTTPServer#start: pid=5376 port=3000
6,访问http://localhost:3000/,成功进入欢迎首页You’re riding Ruby on Rails!
1,创建应用
D:\ror>rails new myapp
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/mailers
create app/models
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/fixtures
create test/functional
create test/integration
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep
2,启动服务
D:\ror>cd myapp
D:\ror\myapp>rails server
Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
---回过头来想想,下面的步骤或许都不需要,只要运行下bundle install就行了(未验证)
3,安装sqlite3-ruby
D:\ror\myapp>gem install sqlite3-ruby
=============================================================================
You've installed the binary version of sqlite3-ruby.
It was built using SQLite3 version 3.6.23.1.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files where available
in the following download:
http://www.sqlite.org/sqlitedll-3_6_23_1.zip
You can put the sqlite3.dll available in this package in your Ruby bin
directory, for example C:\Ruby\bin
=============================================================================
Successfully installed sqlite3-ruby-1.3.1-x86-mingw32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.1-x86-mingw32...
Installing RDoc documentation for sqlite3-ruby-1.3.1-x86-mingw32...
4,再次启动服务,跳出一个错误框,见附件,提示
没有找到sqlite3.dll,因此这个应用程序未能启动,重新安装应用程序可能会解决这个问题
D:\ror\myapp>rails server
c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
from c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
from D:/ror/myapp/config/application.rb:7:in `<top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:28:in `require'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:28:in `block in <top (required)>'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:27:in `tap'
from c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
--不急,上面安装完sqlite3-ruby,有提示http://www.sqlite.org/sqlitedll-3_6_23_1.zip 下载获得sqlite3.dll,放到c:\ruby192\bin下。照做。
5,再次启动服务,成功
D:\ror\myapp>rails server
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-10-20 01:49:57] INFO WEBrick 1.3.1
[2010-10-20 01:49:57] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2010-10-20 01:49:57] INFO WEBrick::HTTPServer#start: pid=5376 port=3000
6,访问http://localhost:3000/,成功进入欢迎首页You’re riding Ruby on Rails!
发表评论
-
fonts in ubuntu
2010-11-17 22:41 1055You can install various fonts i ... -
`require': no such file to load -- readline (LoadError)
2010-11-17 16:56 1782When I type rails console, I ge ... -
simple_captcha
2010-11-17 02:40 2953https://github.com/kares/simple ... -
RMagick
2010-11-17 01:00 17061,安装必要的LIB sudo apt ... -
备份ruby-1.9.2-p0.tar.bz2
2010-11-16 18:16 919每次下载都很慢,备份下,有需要的朋友可以直接下载 -
开发环境从windows转到linux
2010-11-15 23:46 913开发工具用gedit 下载附件,里面的文件解压缩到root目录 ... -
will_paginate
2010-11-09 17:22 964#will_paginat 中文化 application_ ... -
rails3测试相关
2010-11-07 16:04 1017rake db:create:all --建立test,dev ... -
ubuntu10.10 ruby1.9.2 rails3.0 mysql 架设过程
2010-11-06 19:07 1612ubuntu10.10 ruby1.9.2 rails3.0 ... -
以AJAX发送查询条件给服务器并用partial显示查询结果
2010-10-23 00:44 1098经验证rails3.0.1下 用不了form_remote_t ... -
启用MYSQL后原有程序乱码
2010-10-21 04:43 733发现换了ruby1.9.2和MYSQL以后,原来好好的程序都出 ... -
rails3.0.1数据库从sqlite3迁移到mysql
2010-10-21 03:40 1724rails3.0.1数据库从sqlite3迁移到mysql时出 ... -
ruby1.9.2和rails3.0.1 环境部署
2010-10-20 01:10 1094ruby1.9.2和rails3.0.1已经发布,window ...
相关推荐
总的来说,“Ruby on Rails快速Web应用开发实战”将涵盖如何利用RoR的特性和最佳实践,从零开始创建一个功能完善的Web应用。学习者将深入理解MVC架构,掌握路由配置、数据库设计、视图渲染、测试驱动开发以及如何...
这个“Rails项目源代码”是一个使用Rails构建的图片分享网站的完整源代码,它揭示了如何利用Rails的强大功能来创建一个允许用户上传、分享和浏览图片的应用。 1. **Rails框架基础**: Rails的核心理念是DRY(Don't...
总之,"rails应用--导航栏实例工程"是一个综合性的教程,涵盖了Rails开发中的多个关键环节:路由设置、控制器创建、视图渲染、模型定义、以及后台管理工具的使用。通过实践这个实例,开发者可以深入理解Rails的工作...
Ruby on Rails(简称Rails)是一个开源的Web应用程序框架,它基于Ruby编程语言,由David Heinemeier Hansson在2004年创建。Rails遵循MVC(Model-View-Controller)架构模式,使得开发过程更加高效且简洁。它强调...
- 测试安装: 创建一个简单的Rails应用来验证是否成功安装。 #### 五、练习作业0-Hello World - **目标**: - 学习如何创建第一个Rails应用程序。 - **过程**: - 创建新项目。 - 设置数据库配置。 - 创建控制器...
### 应用Rails进行REST开发 #### 1.1 什么是REST? REST(Representational State Transfer),这是一种由Roy Fielding在他的博士论文中提出的架构风格。REST的核心思想是通过标准HTTP协议中的GET、POST、PUT、...
【Ruby-Slackathon在Rails应用程序中构建slack集成的简单方法】 在当今的协作环境中,Slack已经成为团队沟通的重要工具。通过将Slack与Rails应用程序集成,开发者可以创建自定义的自动化工作流程,提高团队效率并...
创建Controller也很简单,比如创建一个名为products的Controller,并带有index动作: ```bash rails g controller products index ``` 这会生成一个`products_controller.rb`文件以及对应的视图文件`index....
Rails Blueprint正是这样的工具,它预先设定了许多常见的文件结构和配置,包括数据库迁移、模型、控制器、视图以及测试等,只需简单几步,就能生成一个基本的Rails 5项目结构。 在"rails-blueprint-master"这个...
Figaro就是这样一款工具,它为Rails应用程序提供了一个简单的方式来管理这些配置,使得环境变量的设置更加方便且易于维护。 Figaro的核心功能是将敏感的配置信息(如数据库密码、API密钥等)从代码库中分离出来,以...
3. **actionmailer-2.1.0.gem**:ActionMailer使得在Rails应用中发送和接收电子邮件变得简单。它提供了一个抽象层,可以方便地创建、发送和接收邮件,同时处理SMTP服务器的配置和其他邮件相关的设置。 4. **...
- **快速体验Ruby on Rails**:通过创建一个简单的应用来快速上手Ruby on Rails的基本工作流程。 - **创建项目**:使用`rails new`命令创建一个新的Rails项目。 - **配置Git**:设置版本控制系统,确保代码变更...
Rails指南中文版是针对Ruby on Rails框架的一份详尽教程,旨在帮助开发者深入理解并熟练掌握这个强大的Web应用开发...通过深入学习和实践,你将成为一名高效的Rails开发者,能够创建出优雅、高效且易于维护的Web应用。
Ruby-APITaster是一款强大的工具,专为Rails应用的API测试和可视化设计。它使得开发者能够迅速地对API接口进行互动式测试,从而确保API的功能正确性和性能稳定性。这款工具的出现,极大地简化了API测试过程,提高了...
在博文链接中,作者张景强可能会详细解释如何创建一个简单的博客应用,包括: 1. 初始化项目:通过`rails new mybook`命令创建新的Rails应用。 2. 创建资源:使用`rails generate controller Posts`生成控制器,再...
12. **Rails API模式**:Rails 4引入了API模式,使得构建RESTful JSON接口变得更加简单。 13. **Webpacker和Webpack**:Rails 5.1以后,Webpacker成为默认的前端资产打包工具,整合了Webpack,使得引入现代...
Rails 提供了一系列内置的工具和约定,如ActiveRecord(ORM,对象关系映射),使得数据库操作变得简单。ActiveRecord允许开发者用Ruby代码定义数据库表的结构,以及与表相关的操作,如创建、读取、更新和删除(CRUD...