2008年12月18日 星期四

rails 2.2 extra, delegate,gem

9.3. Delegates With Prefixes

還有一堆玩具
#

past?, today? and future? for Date and Time classes to facilitate date/time comparisons.
#

Array#second through Array#tenth as aliases for Array#[1] through Array#[9]
#

Enumerable#many? to encapsulate collection.size > 1
#

Inflector#parameterize produces a URL-ready version of its input, for use in to_param.
#

Time#advance recognizes fractional days and weeks, so you can do 1.7.weeks.ago, 1.5.hours.since, and so on.


10.1. config.gems

To avoid deployment issues and make Rails applications more self-contained, it's possible to place copies of all of the gems that your Rails application requires in /vendor/gems

*

config.gem gem_name in your config/environment.rb file
*

rake gems to list all configured gems, as well as whether they (and their dependencies) are installed or frozen
*

rake gems:install to install missing gems to the computer
*

rake gems:unpack to place a copy of the required gems into /vendor/gems
*

rake gems:unpack:dependencies to get copies of the required gems and their dependencies into /vendor/gems
*

rake gems:build to build any missing native extensions
*

rake gems:refresh_specs to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them

You can unpack or install a single gem by specifying GEM=gem_name

沒有留言: