diff options
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/assets/stylesheets/fixes.css | 2 | ||||
-rw-r--r-- | railties/guides/source/configuring.textile | 11 | ||||
-rw-r--r-- | railties/guides/source/form_helpers.textile | 8 | ||||
-rw-r--r-- | railties/guides/source/plugins.textile | 2 |
4 files changed, 18 insertions, 5 deletions
diff --git a/railties/guides/assets/stylesheets/fixes.css b/railties/guides/assets/stylesheets/fixes.css index 54efa5b9b7..bf86b29efa 100644 --- a/railties/guides/assets/stylesheets/fixes.css +++ b/railties/guides/assets/stylesheets/fixes.css @@ -12,5 +12,5 @@ .syntaxhighlighter table thead, .syntaxhighlighter table caption, .syntaxhighlighter textarea { - line-height: 1.2em !important; + line-height: 1.25em !important; } diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 95f93101ab..451235d41d 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -122,6 +122,17 @@ WARNING: Threadsafe operation is incompatible with the normal workings of develo * +config.whiny_nils+ enables or disables warnings when a certain set of methods are invoked on +nil+ and it does not respond to them. Defaults to true in development and test environments. +* +config.console+ allows you to set class that will be used as console you run +rails console+. It's best to run it in +console+ block: + +<ruby> +console do + # this block is called only when running console, + # so we can safely require pry here + require "pry" + config.console = Pry +end +</ruby> + h4. Configuring Assets Rails 3.1, by default, is set up to use the +sprockets+ gem to manage assets within an application. This gem concatenates and compresses assets in order to make serving them much less painful. diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 9758b639cf..2de4d49cf2 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -150,7 +150,7 @@ NOTE: Always use labels for checkbox and radio buttons. They associate text with h4. Other Helpers of Interest -Other form controls worth mentioning are textareas, password fields, hidden fields, search fields, telephone fields, URL fields and email fields: +Other form controls worth mentioning are textareas, password fields, hidden fields, search fields, telephone fields, date fields, URL fields and email fields: <erb> <%= text_area_tag(:message, "Hi, nice site", :size => "24x6") %> @@ -158,6 +158,7 @@ Other form controls worth mentioning are textareas, password fields, hidden fiel <%= hidden_field_tag(:parent_id, "5") %> <%= search_field(:user, :name) %> <%= telephone_field(:user, :phone) %> +<%= date_field(:user, :born_on) %> <%= url_field(:user, :homepage) %> <%= email_field(:user, :address) %> </erb> @@ -170,13 +171,14 @@ Output: <input id="parent_id" name="parent_id" type="hidden" value="5" /> <input id="user_name" name="user[name]" size="30" type="search" /> <input id="user_phone" name="user[phone]" size="30" type="tel" /> +<input id="user_born_on" name="user[born_on]" type="date" /> <input id="user_homepage" size="30" name="user[homepage]" type="url" /> <input id="user_address" size="30" name="user[address]" type="email" /> </html> Hidden inputs are not shown to the user but instead hold data like any textual input. Values inside them can be changed with JavaScript. -IMPORTANT: The search, telephone, URL, and email inputs are HTML5 controls. If you require your app to have a consistent experience in older browsers, you will need an HTML5 polyfill (provided by CSS and/or JavaScript). There is definitely "no shortage of solutions for this":https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills, although a couple of popular tools at the moment are "Modernizr":http://www.modernizr.com/ and "yepnope":http://yepnopejs.com/, which provide a simple way to add functionality based on the presence of detected HTML5 features. +IMPORTANT: The search, telephone, date, URL, and email inputs are HTML5 controls. If you require your app to have a consistent experience in older browsers, you will need an HTML5 polyfill (provided by CSS and/or JavaScript). There is definitely "no shortage of solutions for this":https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills, although a couple of popular tools at the moment are "Modernizr":http://www.modernizr.com/ and "yepnope":http://yepnopejs.com/, which provide a simple way to add functionality based on the presence of detected HTML5 features. TIP: If you're using password input fields (for any purpose), you might want to configure your application to prevent those parameters from being logged. You can learn about this in the "Security Guide":security.html#logging. @@ -467,7 +469,7 @@ Rails _used_ to have a +country_select+ helper for choosing countries, but this h3. Using Date and Time Form Helpers -The date and time helpers differ from all the other form helpers in two important respects: +You can choose not to use the form helpers generating HTML5 date input fields and use the alternative date and time helpers. These date and time helpers differ from all the other form helpers in two important respects: # Dates and times are not representable by a single input element. Instead you have several, one for each component (year, month, day etc.) and so there is no single value in your +params+ hash with your date or time. # Other helpers use the +_tag+ suffix to indicate whether a helper is a barebones helper or one that operates on model objects. With dates and times, +select_date+, +select_time+ and +select_datetime+ are the barebones helpers, +date_select+, +time_select+ and +datetime_select+ are the equivalent model object helpers. diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index ccff2a1eed..07fd95c825 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -30,7 +30,7 @@ Before you continue, take a moment to decide if your new plugin will be potentia * If your plugin is specific to your application, your new plugin will be a _vendored plugin_. * If you think your plugin may be used across applications, build it as a _gemified plugin_. -h4. Or generate a gemified plugin. +h4. Generate a gemified plugin. Writing your Rails plugin as a gem, rather than as a vendored plugin, lets you share your plugin across different rails applications using |