mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
little details seen while doing a pass through what's new in docrails
This commit is contained in:
parent
2db9a7e930
commit
38310ab1a6
5 changed files with 21 additions and 20 deletions
|
@ -290,7 +290,7 @@ module ActionView
|
|||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options)
|
||||
end
|
||||
|
||||
# Returns a set of html select-tags (one for year, month, day, hour, minute and second) pre-selected with the
|
||||
# Returns a set of html select-tags (one for year, month, day, hour, minute, and second) pre-selected with the
|
||||
# +datetime+. It's also possible to explicitly set the order of the tags using the <tt>:order</tt> option with
|
||||
# an array of symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not
|
||||
# supply a Symbol, it will be appended onto the <tt>:order</tt> passed in. You can also add
|
||||
|
|
|
@ -860,8 +860,8 @@ module ActionView
|
|||
end
|
||||
|
||||
# Returns an input of type "search" for accessing a specified attribute (identified by +method+) on an object
|
||||
# assigned to the template (identified by +object+). Inputs of type "search" may be styled differently by
|
||||
# some browsers
|
||||
# assigned to the template (identified by +object_name+). Inputs of type "search" may be styled differently by
|
||||
# some browsers.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
|
@ -880,7 +880,7 @@ module ActionView
|
|||
# # => <input autosave="false" id="user_name" incremental="true" name="user[name]" onsearch="true" size="30" type="search" />
|
||||
# search_field(:user, :name, :autosave => true, :onsearch => true)
|
||||
# # => <input autosave="com.example.www" id="user_name" incremental="true" name="user[name]" onsearch="true" results="10" size="30" type="search" />
|
||||
|
||||
#
|
||||
def search_field(object_name, method, options = {})
|
||||
options = options.stringify_keys
|
||||
|
||||
|
@ -902,7 +902,7 @@ module ActionView
|
|||
#
|
||||
# telephone_field("user", "phone")
|
||||
# # => <input id="user_phone" name="user[phone]" size="30" type="tel" />
|
||||
|
||||
#
|
||||
def telephone_field(object_name, method, options = {})
|
||||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("tel", options)
|
||||
end
|
||||
|
@ -912,7 +912,7 @@ module ActionView
|
|||
#
|
||||
# url_field("user", "homepage")
|
||||
# # => <input id="user_homepage" size="30" name="user[homepage]" type="url" />
|
||||
|
||||
#
|
||||
def url_field(object_name, method, options = {})
|
||||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options)
|
||||
end
|
||||
|
@ -921,7 +921,7 @@ module ActionView
|
|||
#
|
||||
# email_field("user", "address")
|
||||
# # => <input id="user_address" size="30" name="user[address]" type="email" />
|
||||
|
||||
#
|
||||
def email_field(object_name, method, options = {})
|
||||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options)
|
||||
end
|
||||
|
|
|
@ -42,7 +42,7 @@ h4. What is Fingerprinting and Why Should I Care?
|
|||
|
||||
Fingerprinting is a technique where the filenames of content that is static or infrequently updated is altered to be unique to the content contained in the file.
|
||||
|
||||
When a filename is unique and based on its content, http headers can be set to encourage caches everywhere (at ISPs, in browsers) to keep their own copy of the content. When the content is updated, the fingerprint will change and the remote clients will request the new file. This is generally known as _cachebusting_.
|
||||
When a filename is unique and based on its content, HTTP headers can be set to encourage caches everywhere (at ISPs, in browsers) to keep their own copy of the content. When the content is updated, the fingerprint will change and the remote clients will request the new file. This is generally known as _cachebusting_.
|
||||
|
||||
The most effective technique is to insert a hash of the content into the name, usually at the end. For example a CSS file +global.css+ is hashed and the filename is updated to incorporate the hash.
|
||||
|
||||
|
@ -218,7 +218,7 @@ Keep in mind that the order of these pre-processors is important. For example, i
|
|||
|
||||
h3. In Development
|
||||
|
||||
In the development environment assets are compiled and cached on the first request after the server is started. Sprockets sets a +must-validate+ cache-control http header to reduce request overhead on subsequent requests - on these the browser gets a 304 (not-modified) response.
|
||||
In the development environment assets are compiled and cached on the first request after the server is started. Sprockets sets a +must-validate+ Cache-Control HTTP header to reduce request overhead on subsequent requests - on these the browser gets a 304 (not-modified) response.
|
||||
|
||||
If any of the files in the manifest have changed between requests, the server will respond with a new compiled file.
|
||||
|
||||
|
@ -258,9 +258,9 @@ On the first request the assets are compiled and cached as described above, howe
|
|||
/assets/application-4dd5b109ee3439da54f5bdfd78a80473.css
|
||||
</plain>
|
||||
|
||||
The MD5 is generated from the contents of the compiled files, and is included in the http +Content-MD5+ header.
|
||||
The MD5 is generated from the contents of the compiled files, and is included in the HTTP +Content-MD5+ header.
|
||||
|
||||
Sprockets also sets the +Cache-Control+ http header to +max-age=31536000+. This signals all caches between your server and the client browser that this content (the file served) can be cached for 1 year. The effect of this is to reduce the number of requests for this asset from your server; the asset has a good chance of being in the local browser cache or some intermediate cache.
|
||||
Sprockets also sets the +Cache-Control+ HTTP header to +max-age=31536000+. This signals all caches between your server and the client browser that this content (the file served) can be cached for 1 year. The effect of this is to reduce the number of requests for this asset from your server; the asset has a good chance of being in the local browser cache or some intermediate cache.
|
||||
|
||||
This behavior is controlled by the setting of +config.action_controller.perform_caching+ setting in Rails (which is +true+ for production, +false+ for everything else). This value is propagated to Sprockets during initialization for use when action_controller is not available.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rbconfig'
|
|||
require 'rails/engine/railties'
|
||||
|
||||
module Rails
|
||||
# Rails::Engine allows you to wrap a specific Rails application or subset of
|
||||
# <tt>Rails::Engine</tt> allows you to wrap a specific Rails application or subset of
|
||||
# functionality and share it with other applications. Since Rails 3.0, every
|
||||
# <tt>Rails::Application</tt> is just an engine, which allows for simple
|
||||
# feature and application sharing.
|
||||
|
@ -176,6 +176,7 @@ module Rails
|
|||
# == Engine name
|
||||
#
|
||||
# There are some places where an Engine's name is used:
|
||||
#
|
||||
# * routes: when you mount an Engine with <tt>mount(MyEngine::Engine => '/my_engine')</tt>,
|
||||
# it's used as default :as option
|
||||
# * some of the rake tasks are based on engine name, e.g. <tt>my_engine:install:migrations</tt>,
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'set'
|
|||
|
||||
module Rails
|
||||
module Paths
|
||||
# This object is an extended hash that behaves as root of the Rails::Paths system.
|
||||
# This object is an extended hash that behaves as root of the <tt>Rails::Paths</tt> system.
|
||||
# It allows you to collect information about how you want to structure your application
|
||||
# paths by a Hash like API. It requires you to give a physical path on initialization.
|
||||
#
|
||||
|
@ -10,13 +10,13 @@ module Rails
|
|||
# root.add "app/controllers", :eager_load => true
|
||||
#
|
||||
# The command above creates a new root object and add "app/controllers" as a path.
|
||||
# This means we can get a Path object back like below:
|
||||
# This means we can get a +Rails::Paths::Path+ object back like below:
|
||||
#
|
||||
# path = root["app/controllers"]
|
||||
# path.eager_load? # => true
|
||||
# path.is_a?(Rails::Paths::Path) # => true
|
||||
#
|
||||
# The Path object is simply an array and allows you to easily add extra paths:
|
||||
# The +Path+ object is simply an array and allows you to easily add extra paths:
|
||||
#
|
||||
# path.is_a?(Array) # => true
|
||||
# path.inspect # => ["app/controllers"]
|
||||
|
@ -24,17 +24,17 @@ module Rails
|
|||
# path << "lib/controllers"
|
||||
# path.inspect # => ["app/controllers", "lib/controllers"]
|
||||
#
|
||||
# Notice that when you add a path using #add, the path object created already
|
||||
# contains the path with the same path value given to #add. In some situations,
|
||||
# Notice that when you add a path using +add+, the path object created already
|
||||
# contains the path with the same path value given to +add+. In some situations,
|
||||
# you may not want this behavior, so you can give :with as option.
|
||||
#
|
||||
# root.add "config/routes", :with => "config/routes.rb"
|
||||
# root["config/routes"].inspect # => ["config/routes.rb"]
|
||||
#
|
||||
# The #add method accepts the following options as arguments:
|
||||
# The +add+ method accepts the following options as arguments:
|
||||
# eager_load, autoload, autoload_once and glob.
|
||||
#
|
||||
# Finally, the Path object also provides a few helpers:
|
||||
# Finally, the +Path+ object also provides a few helpers:
|
||||
#
|
||||
# root = Root.new "/rails"
|
||||
# root.add "app/controllers"
|
||||
|
@ -42,7 +42,7 @@ module Rails
|
|||
# root["app/controllers"].expanded # => ["/rails/app/controllers"]
|
||||
# root["app/controllers"].existent # => ["/rails/app/controllers"]
|
||||
#
|
||||
# Check the Path documentation for more information.
|
||||
# Check the <tt>Rails::Paths::Path</tt> documentation for more information.
|
||||
class Root < ::Hash
|
||||
attr_accessor :path
|
||||
|
||||
|
|
Loading…
Reference in a new issue