Updates to remove extra whitespaces and notably fix a whitespace issue with ajax_on_rails causing a code block not to render the entire block properly.

This commit is contained in:
Jeff Dutil 2011-08-16 23:35:40 -04:00
parent 6eadf5d192
commit 6783ce0de4
10 changed files with 1 additions and 22 deletions

View File

@ -478,7 +478,6 @@ javascript_include_tag :monkey # =>
<script type="text/javascript" src="/javascripts/tail.js"></script>
</ruby>
h5. register_stylesheet_expansion
Register one or more stylesheet files to be included when symbol is passed to +stylesheet_link_tag+. This method is typically intended to be called from plugin initialization to register stylesheet files that the plugin installed in +public/stylesheets+.

View File

@ -168,7 +168,6 @@ Track what was the previous value of the attribute.
person.first_name_was #=> "First Name"
</ruby>
Track both previous and current value of the changed attribute. Returns an array if changed else returns nil
<ruby>
#attr_name_change

View File

@ -204,7 +204,6 @@ Likewise, once retrieved an Active Record object can be destroyed which removes
user.destroy
</ruby>
h3. Validations
Active Record allows you to validate the state of a model before it gets written into the database. There are several methods that you can use to check your models and validate that an attribute value is not empty, is unique and not already in the database, follows a specific format and many more. You can learn more about validations in the "Active Record Validations and Callbacks guide":active_record_validations_callbacks.html#validations-overview.

View File

@ -24,16 +24,12 @@ h4. Standard HTML communication vs AJAX
How do 'standard' and AJAX requests differ, why does this matter for understanding AJAX on Rails (tie in for *_remote helpers, the next section)
h3. Built-in Rails Helpers
Rails' JavaScript framework of choice is "Prototype":http://www.prototypejs.org. Prototype is a generic-purpose JavaScript framework that aims to ease the development of dynamic web applications by offering DOM manipulation, AJAX and other JavaScript functionality ranging from utility functions to object oriented constructs. It is not specifically written for any language, so Rails provides a set of helpers to enable seamless integration of Prototype with your Rails views.
To get access to these helpers, all you have to do is to include the prototype framework in your pages - typically in your master layout, application.html.erb - like so:
<ruby>
javascript_include_tag 'prototype'
</ruby>
@ -59,7 +55,6 @@ link_to_remote "Add to cart",
</ruby>
* The very first parameter, a string, is the text of the link which appears on the page.
* The second parameter, the +options+ hash is the most interesting part as it has the AJAX specific stuff:
** *:url* This is the only parameter that is always required to generate the simplest remote link (technically speaking, it is not required, you can pass an empty +options+ hash to +link_to_remote+ - but in this case the URL used for the POST request will be equal to your current URL which is probably not your intention). This URL points to your AJAX action handler. The URL is typically specified by Rails REST view helpers, but you can use the +url_for+ format too.
** *:update* Specifying a DOM id of the element we would like to update. The above example demonstrates the simplest way of accomplishing this - however, we are in trouble if the server responds with an error message because that will be injected into the page too! However, Rails has a solution for this situation:
@ -193,7 +188,6 @@ end
What happens here is that by specifying the Content-Type header variable, we instruct the browser to evaluate the text we are sending over (rather than displaying it as plain text, which is the default behavior).
h3. Testing JavaScript
JavaScript testing reminds me the definition of the world 'classic' by Mark Twain: "A classic is something that everybody wants to have read and nobody wants to read." It's similar with JavaScript testing: everyone would like to have it, yet it's not done by too much developers as it is tedious, complicated, there is a proliferation of tools and no consensus/accepted best practices, but we will nevertheless take a stab at it:

View File

@ -106,7 +106,6 @@ routes.rb # NO
RAILS_ROOT/config/routes.rb # NO
</plain>
h3. Fonts
h4. Fixed-width Font
@ -188,4 +187,3 @@ self.class_eval %{
h3. Changelog
* July 17, 2010: ported from the docrails wiki and revised by "Xavier Noria":credits.html#fxn

View File

@ -27,7 +27,6 @@ config.assets.enabled = false
It is recommended that you use the defaults for all new apps.
h4. Main Features
The first feature of the pipeline is to concatenate assets. This is important in a production environment, as it reduces the number of requests that a browser must make to render a web page. While Rails already has a feature to concatenate these types of assetsi -- by placing +:cache => true+ at the end of tags such as +javascript_include_tag+ and +stylesheet_link_tag+ -- many people do not use it.
@ -80,7 +79,6 @@ More reading:
* "Optimize caching":http://code.google.com/speed/page-speed/docs/caching.html
* "Revving Filenames: dont use querystring":http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
h3. How to Use the Asset Pipeline
In previous versions of Rails, all assets were located in subdirectories of +public+ such as +images+, +javascripts+ and +stylesheets+. With the asset pipeline, the preferred location for these assets is now the +app/assets+ directory. Files in this directory are served by the Sprockets middleware included in the sprockets gem.
@ -324,7 +322,6 @@ When files are precompiled, Sprockets also creates a "Gzip":http://en.wikipedia.
TODO: Apache instructions
h3. Customizing the Pipeline
@ -372,7 +369,6 @@ To enable this, pass a +new+ Object to the config option in +application.rb+:
config.assets.css_compressor = Transformer.new
</erb>
h4. Changing the _assets_ Path
The public path that Sprockets uses by default is +/assets+.

View File

@ -404,7 +404,6 @@ h3. Further reading
* "Scaling Rails Screencasts":http://railslab.newrelic.com/scaling-rails
h3. Changelog
* Feb 17, 2011: Document 3.0.0 changes to ActiveSupport::Cache
@ -415,4 +414,3 @@ h3. Changelog
* December 27, 2008: Typo fixes
* November 23, 2008: Incremental updates with various suggested changes and formatting cleanup
* September 15, 2008: Initial version by Aditya Chadha

View File

@ -104,7 +104,6 @@ $ cd railties
$ TEST_DIR=generators rake test
</shell>
h4. Warnings
The test suite runs with warnings enabled. Ideally Ruby on Rails should issue no warning, but there may be a few, and also some from third-party libraries. Please ignore (or fix!) them if any, and submit patches that do not issue new warnings.

View File

@ -342,7 +342,6 @@ output:
When parsing POSTed data, Rails will take into account the special +_method+ parameter and acts as if the HTTP method was the one specified inside it ("PUT" in this example).
h3. Making Select Boxes with Ease
Select boxes in HTML require a significant amount of markup (one +OPTION+ element for each option to choose from), therefore it makes the most sense for them to be dynamically generated.

View File

@ -116,7 +116,6 @@ need to know anything about them to continue with this guide.
* Active Support
* Railties
h5. Action Pack
Action Pack is a single gem that contains Action Controller, Action View and
@ -1633,7 +1632,6 @@ Authentication challenge
!images/challenge.png(Basic HTTP Authentication Challenge)!
h3. Building a Multi-Model Form
Another feature of your average blog is the ability to tag posts. To implement