Ruby On Rails in UA Icon_home Главная Add to bookmarks Translate translate Profile Войти
Регистрация Форум Блоги Пользователи Список джемов Rails проекты      Поиск   

Ruby On Rails in UA/Новости, баги, и прочее/Routing - rails 2.0

2008-06-10 13:30:59 Ответить  
admin
Ruslan Voloshin
Адрес: odessa
Сообщений: 1294
Регистр: 2007-03-13
его блог 40 сообщ.
Routing - rails 2.0
  •  
Add support in routes for semicolon delimited "subpaths", like /books/:id;:action
Allow dynamic routes: map.connect '*path', :controller => 'files', :action => 'show'
Routing rewrite:

Add route_name_path method to generate only the path for a named routes. For example, map.person will add person_path
Added map.resources from the Simply Restful plugin:

Add controller_paths variable to Routing
Relax Routing's anchor pattern warning; it was preventing use of [^/] inside restrictions
Added map.root as an alias for map.connect ''
Add singleton resources.

Singleton resources: POST /singleton => create, GET /singleton/new => new
Allow routing requirements on map.resource(s). Example:
map.resources :network_interfaces, :requirements => { :id => /^\d+\.\d+\.\d+\.\d+$/ }
Added :has_many and :has_one for declaring plural and singular resources beneath the current
Before:

After:

Added :name_prefix as standard for nested resources.
Before:

After:

This does mean that if you intended to have comments_url go to /emails/5/comments, then you'll have to set :name_prefix to nil explicitly.
Added map.namespace to deal with the common situation of admin sections and the like [DHH]
Before:

After:

Allow routes to be declared under namespaces:

Resource namespaces are inherited by their has_many subresources
url_for([parent, child]) generates /parents/1/children/2 for the nested resource. Likewise with the other simply helpful methods like form_for and link_to
map.resource :logo routes to LogosController so the controller may be reused for multiple nestings or namespaces
Allow you to set custom :conditions on resource routes
Prevent errors when generating routes for uncountable resources, (i.e. sheep where plural == singluar).
map.resources :sheep now creates sheep_index_url for the collection and sheep_url for the specific item
Allow additional parameters to be passed to named route helpers when using positional arguments

Testing
Allow #assert_recognizes to take a second arg as a hash to specify optional request method

Added assert_select* for CSS selector-based testing
Add support for assert_select_rjs with :show and :hide
Add chained replace/update support for assert_select_rjs.
Given RJS like...

Test it with...

Add a 'referer' attribute to TestRequest
Introduce a new test case class for functional tests

Deprecations, Re/moves

@cookies, @headers, @request, @response. Use the corresponding instance methods instead.
assert_tag (use assert_select*)
pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin
UrlHelper#link_to_image and UrlHelper#link_to :post => true
start_form_tag and end_form_tag. Use form_tag / '' from now on
expire_matched_fragments. Use expire_fragment instead
JavaScriptHelper#update_element_function, which is superseeded by RJS
Remove deprecated request, redirect, and dependency methods.
Remove deprecated url_for(:symbol, *args) and redirect_to(:symbol, *args) in favor of named routes.
Remove uses_component_template_root for toplevel components directory.
Privatize deprecated render_partial and render_partial_collection view methods.
Remove deprecated link_to_image, link_image_to, update_element_function, start_form_tag, and end_form_tag helper methods.
Remove deprecated human_size helper alias.
Extract dynamic scaffolding into a plugin
Removed deprecated parameters_for_method_reference concept (legacy from before named routes)
Removed ActionController::Base.scaffold . Use the scaffold generator instead
Removed the deprecated behavior of appending ".png" to image_tag/image_path calls without an existing extension
Removed deprecated methods:
- ActionController::Base#keep_flash (use flash.keep instead)
- ActionController::Base#expire_matched_fragments (just call expire_fragment with a regular expression)
- ActionController::Base.template_root/= methods (use ActionController#Base.view_paths/= instead)
- ActionController::Base.cookie (use ActionController#Base.cookies[]= instead)
Removed deprecated form of calling xml_http_request/xhr without the first argument being the http verb
Moved ActionController::Macros::AutoComplete into the auto_complete plugin
Moved ActionController::Macros::InPlaceEditing into the in_place_editor plugin
------------
Занимаюсь вебом и продвижением сайтов.
,
Назадназад Новыйновый Ответитьответить
Ключевые слова:
Гости: 324 Онлайн: Gorbanas,
Rambler's Top100
О проекте по всем вопросам обращайтесь на support
Rubyclub.com.ua Copyright © 2007 - 2008