Rails

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(Rails 4)
(安装)
 
(未显示1个用户的16个中间版本)
第1行: 第1行:
 +
{{SeeWikipedia|Ruby on Rails}}
 +
 
[[Image:Rails-90x90.png|right]]
 
[[Image:Rails-90x90.png|right]]
  
 +
Ruby on Rails
 +
 +
==简介==
 
[[Ruby]] on [[Image:Rails.jpeg]] 是一个相对较新的 Web 应用程序框架,构建在 Ruby 语言之上。它被宣传为现有企业框架的一个替代,而它的目标,简而言之,就是让生活,至少是 Web 开发方面的生活,变得更轻松。
 
[[Ruby]] on [[Image:Rails.jpeg]] 是一个相对较新的 Web 应用程序框架,构建在 Ruby 语言之上。它被宣传为现有企业框架的一个替代,而它的目标,简而言之,就是让生活,至少是 Web 开发方面的生活,变得更轻松。
  
 
[[Image:rails-web-server.jpg|right|Rails可在以下Web Server部署]]  
 
[[Image:rails-web-server.jpg|right|Rails可在以下Web Server部署]]  
 +
 +
==功能==
  
 
==开发指南==
 
==开发指南==
第14行: 第21行:
  
 
==深入Rails==
 
==深入Rails==
 +
[[文件:rails-logo.png|right|Rails]]
 
*[http://opinion.rubytao.com/ruby/rails-source-code-reading Rails框架代码解读]
 
*[http://opinion.rubytao.com/ruby/rails-source-code-reading Rails框架代码解读]
 
Rails组件:
 
Rails组件:
第24行: 第32行:
 
*Active Support
 
*Active Support
  
==安装 Ruby & Rails==
+
==安装==
 +
[[RubyGems]] is a package manager for Ruby.
 
  gem install rails
 
  gem install rails
 +
or gem install -v=5.2 rails
 
  rails new myapp
 
  rails new myapp
 
  cd myapp; rails server
 
  cd myapp; rails server
第48行: 第58行:
 
Windows
 
Windows
 
  http://download.huihoo.com/ruby/ruby186-26_rc2.exe
 
  http://download.huihoo.com/ruby/ruby186-26_rc2.exe
 +
 +
==Rails 6==
 +
[https://weblog.rubyonrails.org/2020/12/9/Rails-6-1-0-release/ Rails 6.1]
  
 
==Rails 5==
 
==Rails 5==
第109行: 第122行:
 
*Building Relationships Between Rails Models http://www.netbeans.org/kb/60/ruby/model.html  
 
*Building Relationships Between Rails Models http://www.netbeans.org/kb/60/ruby/model.html  
 
*Adding Ajax Support: http://www.netbeans.org/kb/60/ruby/ajax.html
 
*Adding Ajax Support: http://www.netbeans.org/kb/60/ruby/ajax.html
==成功应用==
+
 
 +
==用户==
 
*[http://twitter.com/ Twitter]
 
*[http://twitter.com/ Twitter]
 
*[http://github.com/ GitHub]
 
*[http://github.com/ GitHub]
第124行: 第138行:
 
*http://www.myd2d.com/
 
*http://www.myd2d.com/
  
==Projects==
+
==项目==
 +
[[文件:Mastodon-logo.png|right|Mastodon]]
 +
[[文件:Shopify-logo.png|right|Shopify]]
 
*[https://github.com/ekremkaraca/awesome-rails Awesome Rails] [[image:awesome.png]]
 
*[https://github.com/ekremkaraca/awesome-rails Awesome Rails] [[image:awesome.png]]
 
*[https://github.com/hothero/awesome-rails-gem Awesome Rails Gem] [[image:awesome.png]]
 
*[https://github.com/hothero/awesome-rails-gem Awesome Rails Gem] [[image:awesome.png]]
 +
*[https://github.com/orgs/Shopify/repositories?language=ruby Shopify @ GitHub] 可能是世界上最大的 [[Ruby]] & Rails 团队
 +
*[https://github.com/thoughtbot/suspenders Suspenders]
 +
*[https://github.com/RailsApps/rails-composer Rails Composer]
 +
*[[Mastodon]]
 +
*[[Redmine]]
 +
*[[OpenProject]]
 +
*[[Spree commerce]]
 +
*[[diaspora]]
 +
*[[Puma]]
 +
*[[Travis CI]]
 
*[[Radiant CMS]] - Content Management Simplified
 
*[[Radiant CMS]] - Content Management Simplified
 
*[[LoginGenerator]]
 
*[[LoginGenerator]]
第144行: 第170行:
  
 
==数据库==
 
==数据库==
*MySQL - http://www.tmtm.org/en/mysql/ruby
+
*[[MySQL]] - http://www.tmtm.org/en/mysql/ruby
*PostgreSQL - http://ruby.scripting.ca/postgres
+
*[[PostgreSQL]] - http://ruby.scripting.ca/postgres
*SQLite - http://rubyforge.org/projects/sqlite-ruby
+
*[[SQLite]] - http://rubyforge.org/projects/sqlite-ruby
*Oracle - http://rubyforge.org/projects/ruby-oci8
+
*[[Oracle]] - http://rubyforge.org/projects/ruby-oci8
*DB2 - http://raa.ruby-lang.org/project/ruby-db2
+
*[[DB2]] - http://raa.ruby-lang.org/project/ruby-db2
 +
*[https://guides.rubyonrails.org/active_record_postgresql.html Active Record and PostgreSQL]
 +
*[https://guides.rubyonrails.org/active_record_multiple_databases.html Multiple Databases with Active Record]
  
==相关链接==
+
==链接==
 
*[http://site.huihoo.com/ruby.html Ruby & Rails 网址]  
 
*[http://site.huihoo.com/ruby.html Ruby & Rails 网址]  
 
*http://www.rubyonrails.org/
 
*http://www.rubyonrails.org/
第165行: 第193行:
 
[[Image:rorcast.jpg]] - http://blogs.huihoo.com/?p=254
 
[[Image:rorcast.jpg]] - http://blogs.huihoo.com/?p=254
  
==在线文档==
+
==文档==
 
*Ruby 1.4.6 - http://www.huihoo.com/ruby/ruby-man-1.4/
 
*Ruby 1.4.6 - http://www.huihoo.com/ruby/ruby-man-1.4/
 
*Ruby User's Guide - http://www.huihoo.com/ruby/rug/
 
*Ruby User's Guide - http://www.huihoo.com/ruby/rug/
第353行: 第381行:
 
*[http://wish.hu Wish Internet]
 
*[http://wish.hu Wish Internet]
  
==精彩图集==
+
==图集==
 
<gallery widths=100px heights=100px perrow=6>
 
<gallery widths=100px heights=100px perrow=6>
 
Image:Rails-stack.jpg|Rails和J2EE堆栈的比较
 
Image:Rails-stack.jpg|Rails和J2EE堆栈的比较
第374行: 第402行:
 
Image:Ruby_on_rails_cheat_sheet.png|RoR cheat sheet
 
Image:Ruby_on_rails_cheat_sheet.png|RoR cheat sheet
 
</gallery>
 
</gallery>
 
{{comment}}
 
  
 
[[category:programming language]]
 
[[category:programming language]]
 
[[category:ruby]]
 
[[category:ruby]]
 
[[category:rails]]
 
[[category:rails]]
 +
[[category:Huihoo Foundation]]

2023年6月11日 (日) 02:02的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Rails Thanks, Wikipedia.
Rails-90x90.png

Ruby on Rails

目录

[编辑] 简介

Ruby on Rails.jpeg 是一个相对较新的 Web 应用程序框架,构建在 Ruby 语言之上。它被宣传为现有企业框架的一个替代,而它的目标,简而言之,就是让生活,至少是 Web 开发方面的生活,变得更轻松。

Rails可在以下Web Server部署

[编辑] 功能

[编辑] 开发指南

[编辑] 深入Rails

Rails

Rails组件:

  • Action Controller
  • Action View
  • Active Record
  • Action Mailer
  • Active Resource
  • Railties
  • Active Support

[编辑] 安装

RubyGems is a package manager for Ruby.

gem install rails
or gem install -v=5.2 rails
rails new myapp
cd myapp; rails server
http://localhost:3000

注:不用apt-get install rails 因版本较旧

旧版:安装 Ruby:

Linux/UNIX

http://download.huihoo.com/ruby/ruby-1.8.6.tar.gz
tar xzvf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure –prefix=/usr/local/ruby
make && make install
修改 .bashrc
export PATH=/usr/local/ruby/bin:$PATH
http://download.huihoo.com/ruby/rubygems-0.8.11.zip
unzip rubygems-0.8.11.zip
cd rubygems-0.8.11
ruby setup.rb
gem install rake

Windows

http://download.huihoo.com/ruby/ruby186-26_rc2.exe

[编辑] Rails 6

Rails 6.1

[编辑] Rails 5

[编辑] Rails 4

[编辑] Rails 3

[编辑] Rails 2

按顺序安装

http://download.huihoo.com/rails/rails-2.1.0.zip
gem install activesupport-2.1.0.gem
gem install activerecord-2.1.0.gem
gem install actionpack-2.1.0.gem
gem install actionmailer-2.1.0.gem
gem install activeresource-2.1.0.gem
gem install rake-0.8.1.gem
gem install rails-2.1.0.gem   
rails -v 显示Rails 2.1.0 :)

或者

gem install -v=2.1.0 rails

[编辑] Rails 1

安装 Rails:

http://download.huihoo.com/rails/rails-1.2.3.zip

按顺序安装

gem install activesupport-1.4.2.gem
gem install activerecord-1.15.3.gem
gem install actionpack-1.13.3.gem
gem install actionmailer-1.3.3.gem
gem install actionwebservice-1.2.3.gem
gem install rails-1.2.3.gem   
rails -v 显示Rails 1.2.3 :)

可能出现的问题: undefined method `gem' for main:Object, 可能是gem的版本太低,升级一下 gem

# gem update --system

Fast CGI and Apache2 for Windows XP

卸载 Rails 1.2.3

gem uninstall Rails
gem uninstall Rake
gem uninstall Actionwebservice
gem uninstall Actionmailer
gem uninstall Actionpack
gem uninstall Activesupport
gem uninstall Activerecord

[编辑] Simple Weblog

Sample Weblog

强力推荐这个例子 :)

  • Use Rake tasks and migration files to create and update database tables
  • Use the scaffold generator to generate a basic create, read, update, delete (CRUD) database web application
  • Edit views to fine tune the web pages
  • how to build relationships (one-to-one and one-to-many) between models

逐步创建的表结构:

001_create_posts.rb
002_add_body_to_post.rb // 加入新的字段
003_create_comments.rb // 创建新的表

[编辑] 用户

[编辑] 项目

Mastodon
Shopify

[编辑] Eclipse

[编辑] 数据库

[编辑] 链接

Rorcast.jpg - http://blogs.huihoo.com/?p=254

[编辑] 文档

[编辑] 书籍

Agile-web-rails.gif http://www.china-pub.com/computers/common/info.asp?id=30058

第一版代码:

第二版代码:

第三版代码:

第四版代码:

[编辑] Top ROR Demos Exampls Code

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Rails Thanks, Wikipedia.

[编辑] Top ROR Hosts

[编辑] 图集

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱