ruby on rails_Ruby on Rails RoR

ruby on rails

Ruby on Rails(RoR) (Ruby on Rails (RoR))

Ruby on Rails, also known as RoR or Rails web framework is a free written in Ruby. It follows the design pattern Model-View-Controller MVC also appointed. It lets you create web applications quickly, because it imposes a structure to the programmer, and thus requires it to be a logic and approach that supports the achievement of the application. It also adds a great level of abstraction in programming the application, through a set of high level functions to focus primarily on functionality rather than the mechanics around these features.

Ruby on Rails,也称为RoR或Rails Web框架是用Ruby免费编写的。 它遵循也指定的设计模式Model-View-Controller MVC。 它使您可以快速创建Web应用程序,因为它为程序员强加了结构,因此要求它成为支持应用程序实现的逻辑和方法。 通过一组高级功能(主要侧重于功能而不是围绕这些功能的机制),它还为应用程序编程增加了高度抽象。

Ruby on Rails –哲学 (Ruby on Rails – Philosophy)

Rails is based on two fundamental principles:

Rails基于两个基本原则:

“Do not repeat”

“不要重复”

Try as much as possible to have elements of the application to a single location. The MVC architecture and meta programming in Ruby makes this possible.

尽可能尝试将应用程序的元素放置在单个位置。 Ruby中的MVC架构和元编程使这成为可能。

约定优于配置 (Convention over configuration)

It is unnecessary to specify details of where they comply with established conventions. Rails exploits this by providing default behavior for most of its features. This vision will be preserved even after the merger with Merb and future modularization framework.

无需详细说明它们在哪些方面遵守既定惯例。 Rails通过为其大多数功能提供默认行为来利用这一点。 即使与Merb和未来的模块化框架合并之后,这一愿景也将得以保留。

When starting a project Rails, some configuration elements are present. Generally found that as the login / password to access the database in MySQL (essential example). However, we can start a project without configure anything, with the use (by default) SQLite. The configuration files are YAML type.

启动项目Rails时,会出现一些配置元素。 一般发现在MySQL中作为登录名/密码来访问数据库(本质示例)。 但是,我们可以使用SQLite(默认情况下)启动项目而无需进行任何配置。 配置文件是YAML类型。

The first version of Ruby on Rails date of July 2004. The framework was extracted from Basecamp, a project management tool developed by David Heinemeier Hansson. The first stable version (1.0) was released December 14, 2005.

Ruby on Rails的第一版发布于2004年7月。该框架摘自Basecamp,这是由David Heinemeier Hansson开发的项目管理工具。 2005年12月14日发布了第一个稳定版本(1.0)。

From that time Ruby on Rails has marked the world of web development. It was seen pushing a set of Rails-like Web Framework (include CakePHP, Symfony and CodeIgniter just for the PHP)

从那时起,Ruby on Rails便标志着Web开发的世界。 可以看到它推了一组类似Rails的Web框架(包括仅用于PHP的CakePHP,Symfony和CodeIgniter)

A preview release of version 2.0 was announced September 30, 2007. Rails 2.0 brings mainly:

2007年9月30日宣布了2.0版的预览版。Rails2.0主要带来:

  • The resources that provide a REST architecture;

    提供REST体系结构的资源;
  • A clearer differentiation between formats and converters (a. Rhtml file becomes .Html.erb, that is to say a file and interpreted by eRuby whose result is the HTML);

    格式和转换器之间的区别更加清晰(一个Rhtml文件变成.Html.erb,也就是说,一个文件并由eRuby解释,其结果是HTML);
  • The ability to use models such as URL (e.g., redirect_to (person));

    使用诸如URL之类的模型的能力(例如redirect_to(person));
  • Management of basic HTTP authentication;

    基本HTTP认证管理;
  • Protection against CSRF attacks;

    防御CSRF攻击;
  • Interception simplest generic exceptions;

    拦截最简单的通用异常;
  • Cache the result of some SQL queries;

    缓存一些SQL查询的结果;
  • Simplification of the writing of migration;

    简化移民的书写;
  • Navigation through all the plugins and modules * act_as_ database owners;

    浏览所有插件和模块* act_as_数据库所有者;
  • The beginning of the abandonment of SOAP in favor of REST;

    开始放弃SOAP取而代之的是REST;
  • A new system that replaces the debug breakpoints;

    替换调试断点的新系统;
  • And many other small changes.

    以及其他许多小变化。

The latest version, 2.3.5 Ruby on Rails (RoR) was released November 30, 2009. Rails 2.3 makes use of middleware, Rack: who can manage server-level applications, and incorporates a reverse proxy. Another important change is the management of child forms from a parent object (nested form).

2009年11月30日发布了最新版本2.3.5 Ruby on Rails(RoR)。Rails2.3使用了中间件Rack:它可以管理服务器级应用程序,并包含反向代理。 另一个重要的更改是从父对象(嵌套表单)管理子表单。

Rails-3 is in fact the meeting between Rails and Merb. Following a complete rewrite, agnostic (the API is generally disconnected from a particular library). A beta release dated February 5, 2010.

实际上,Rails-3是Rails和Merb之间的会议。 完全重写后,不可知(通常将API与特定库断开连接)。 测试版发布日期为2010年2月5日。

架构模型-视图-控制器 (Architecture Model-View-Controller)

Rails provides tools to build an MVC architecture:

Rails提供了用于构建MVC架构的工具:

  • Models are classes for managing data. In general the structure of these classes is determined automatically by Rails from a database. Relationships between tables are explicitly specified (has_many belongs_to). Specifying these relationships allows ActiveRecord to preload elements or parent child classes.

    模型是用于管理数据的类。 通常,这些类的结构由Rails从数据库自动确定。 表之间的关系是明确指定的(has_many当属至)。 指定这些关系可以使ActiveRecord预先加载元素或父子类。
  • The views determine how information is displayed to the user. It is usually a combination of HTML and Ruby files. Html.erb. It is also possible to program in Ruby with pure Builder. Finally there are a multitude of plugins writing systems of basic HTML, the best known is the HAML.

    这些视图确定如何向用户显示信息。 它通常是HTML和Ruby文件的组合。 Html.erb。 也可以使用纯Builder在Ruby中进行编程。 最后,有许多使用基本HTML编写插件的系统,最著名的是HAML。
  • The controllers respond to user actions, they will find the data in the database and make them available to views.

    控制器响应用户的操作,他们将在数据库中找到数据并将其提供给视图。

Rails to quickly create skeletons of a controller or a model or view: This is usually code type scaffolding (or scaffold) that provide common operations on the model such as adding, modifying and deleting records. These bits of initial codes are perfectly adaptable to the specific needs of the application.

用Rails快速创建控制器,模型或视图的骨架:这通常是代码类型的脚手架(或脚手架),提供对模型的常用操作,例如添加,修改和删除记录。 初始代码的这些位完全适合于应用程序的特定需求。

Rails ActionMailer also provides for the management of sending or receiving emails and ActionWebService for SOAP and XML-RPC, and ActiveRessource to query RESTful Web service type.

Rails ActionMailer还为SOAP和XML-RPC提供了收发电子邮件和ActionWebService的管理,并提供了ActiveRessource来查询RESTful Web服务类型。

Ruby on Rails – Rails和Ajax (Ruby on Rails – Rails and Ajax)

AJAX allows for dynamic pages with JavaScript and XML to send requests to the server without reloading the page in the browser. Rails offers several ways to simplify the use of AJAX. The contribution of RJS is to allow the generation of javascript code intended for the browser through online ruby.

AJAX允许具有JavaScript和XML的动态页面将请求发送到服务器,而无需在浏览器中重新加载页面。 Rails提供了几种简化AJAX使用的方法。 RJS的贡献是允许通过在线Ruby生成用于浏览器的javascript代码。

Ruby on Rails – Web服务器 (Ruby on Rails – Web server)

Rails can work with WEBrick, the HTTP server included with Ruby. This method is often used for development and testing. In production, Apache or lighttpd or Mongrel with nginx or thin are recommended.

Rails可以与WEBrick(Ruby随附的HTTP服务器)一起使用。 此方法通常用于开发和测试。 在生产中,建议使用Apache或lighttpd或带有Nginx或Thin的Mongrel。

The use of FastCGI is not recommended from the release 2.3. In fact, the original library mod_ruby Apache has been reworked, and the interface now uses Apache Passenger. Passenger is also available for nginx.

从版本2.3开始不建议使用FastCGI。 实际上,原始库mod_ruby Apache已被重新设计,并且该接口现在使用Apache Passenger。 乘客也可以使用nginx。

Ruby on Rails –管理电子邮件(发送和接收) (Ruby on Rails – Managing email (sending and receiving))

The emails are generated at the views. We can create a view in text format and view HTML, sent in the same mail. The management of attachment is also supported and easy to use.

电子邮件在视图中生成。 我们可以创建文本格式的视图并查看HTML,并在同一封邮件中发送。 还支持附件的管理,并且易于使用。

Regarding the management of incoming mail, it is possible to create a virtual user in postfix or sendmail. But the easiest is to control a mailbox via IMAP with the native ruby library. The management of incoming mail attachments using the same principle that generated emails.

关于传入邮件的管理,可以在postfix或sendmail中创建虚拟用户。 但是最简单的方法是使用本地的ruby库通过IMAP控制邮箱。 使用与生成电子邮件相同的原理来管理传入邮件附件。

ActionMailer API (ActionMailer API)

Ruby on Rails – Databases

Ruby on Rails –数据库

Several management systems database are supported: SQLite, MySQL, PostgreSQL, DB2, Oracle and Microsoft SQL Server. By default, SQLite3 is used.

支持多个管理系统数据库:SQLite,MySQL,PostgreSQL,DB2,Oracle和Microsoft SQL Server。 默认情况下,使用SQLite3。

Ruby on Rails – Distribution

Ruby on Rails –发行

Ruby on Rails is distributed through RubyGems: gem install rails. The source code is also available via GIT.

Ruby on Rails通过RubyGems分发:gem install rails。 也可以通过GIT获得源代码。

Instant Rails distribution proposes a pre-configured version for Microsoft Windows Ruby, Rails, Apache and MySQL. The proposed locomotive provides a simplified installation for Mac OS X. But Ruby on Rails (RoR) is included in the client and server versions of Mac OS X 10.5. Ruby on Rails is also included in many Linux distributions.

Instant Rails发行版提出了针对Microsoft Windows Ruby,Rails,Apache和MySQL的预配置版本。 提议的机车为Mac OS X提供了简化的安装。但是,Mac OS X 10.5的客户端和服务器版本中包含Ruby on Rails(RoR)。 Ruby on Rails也包含在许多Linux发行版中。

Ruby on Rails – Publishers

Ruby on Rails –出版商

The text editor TextMate is used (in Mac OS X) by the core developers of Ruby on Rails. Alternatively and more recently Aptana IDE also offers useful features for developing and debugging Ruby on Rails. 3rdRail IDE CodeGear is for Ruby on Rails. Plugins for the Vim text editor can add useful features to develop in Ruby on Rails. There is also a mode for the Emacs editor.

Ruby on Rails的核心开发人员(在Mac OS X中)使用文本编辑器TextMate。 另外,最近,Aptana IDE还提供了用于开发和调试Ruby on Rails的有用功能。 3rdRail IDE CodeGear适用于Ruby on Rails。 Vim文本编辑器的插件可以添加有用的功能,以便在Ruby on Rails中进行开发。 Emacs编辑器还有一个模式。

Study: From Wikipedia, the free encyclopedia. The text is available under the Creative Commons.

研究:来自维基百科,免费的百科全书。 该文本可在“ 知识共享”下找到

翻译自: https://www.eukhost.com/blog/webhosting/ruby-on-rails-ror/

ruby on rails

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值