Introduction to the new features of Ruby on Rails 2.0

Source: Internet
Author: User
Tags new features pack resource ruby on rails

The High-profile Ruby on Rails 2.0 has been released, and the rails framework has maintained a fairly fast version since its inception in 2004 Upgrade Speed: 2005 released the Rails1.0 version, the early 2006 release Rails1.1 version, the early 2007 release Rails1.2 version, and not until 2008, in 2007 on the eve of December 6, Rails2.0 has been released.

The rails framework each big version upgrade brings us quite a lot of new features, new surprises. Rails1.0 brings us the perfect unit test and integration test; Rails1.1 brings us database migration and rjs;rails1.2 let us see the bright future of rest, so what will Rails2.0 bring to us? I have roughly translated the Rails2.0 framework introduction article written by the rails framework author DHH, which is translated from the DHH article in the following text:

Http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done

After almost a year of development, Rails2.0 finally released. This is a great version of rails that includes a great deal of new features, countless bugfix and a lot of polished features. We have spent countless efforts to create such a perfectly reasonable package.

This is also a milestone in the history of the rails framework development. I personally have been working on the rails framework for 4.5 of the time, and we are now contributing more and more. I am very satisfied with the work we have done over the years and the belief that we have always adhered to. We've been sticking to it and pushing it.

Before detailing the Rails2.0, I would like to express my deep appreciation to everyone who has contributed to the rails framework, whether it's a core development team of rails that is as enjoyable as a family, or thousands of, and year in, rails to submit patches, actively People in the rails community. Rails2.0 is also a big win for the massive open source software development community, and you can be proud of your role and contribution to the rails community. Cheers!

Now let's take a quick peek at the shiny features of rails that did see:

Action pack:resources

The era of controller with a lot of action methods has passed, and we've made a lot of improvements and enhancements to the rest architecture. First, we no longer use semicolons to isolate custom methods, but we use slashes, such as/people/1;edit URLs, which are now/people/1/edit. In addition, we also add namespace support to URL routing resources, so like background management Interface you can have a very simple definition like this:

Map.namespace (: admin) do |admin|
admin.resources:p roducts,
: Collection => {: Inventory =>: Get},
: member => {:d uplicate = >:p ost},
: Has_many => [: Tags,: images,: variants]
end

This approach allows you to define named routes in the following ways, such as Inventory_admin_products_url and Admin_product_tags_url, and so on. To facilitate the recording of all routing rules, we added a rake task called rake routes, which can enumerate all named routing rules defined by ROUTES.RB.

In addition, we have introduced a new convention, that is, all resource-based controller are in the plural form by default. This way, even if a single resource is referenced multiple times in different routing rules, it can still point to the same controller, for example:

#/avatars/45 => avatarscontroller#show
map.resources:avatars
#/people/5/avatar => Avatarscontroller#show
map.resources:p eople: Has_one =>: Avatar 

Action Pack:multiview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.