Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lifo/docrails
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Aug 18, 2011
2 parents 3b5eb11 + 6783ce0 commit 12c0ea9
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 26 deletions.
1 change: 0 additions & 1 deletion railties/guides/source/action_view_overview.textile
Expand Up @@ -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+.
Expand Down
1 change: 0 additions & 1 deletion railties/guides/source/active_model_basics.textile
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion railties/guides/source/active_record_basics.textile
Expand Up @@ -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.
Expand Down
8 changes: 1 addition & 7 deletions railties/guides/source/ajax_on_rails.textile
Expand Up @@ -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>
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions railties/guides/source/api_documentation_guidelines.textile
Expand Up @@ -106,7 +106,6 @@ routes.rb # NO
RAILS_ROOT/config/routes.rb # NO
</plain>


h3. Fonts

h4. Fixed-width Font
Expand Down Expand Up @@ -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

4 changes: 0 additions & 4 deletions railties/guides/source/asset_pipeline.textile
Expand Up @@ -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.
Expand Down Expand Up @@ -80,7 +79,6 @@ More reading:
* "Optimize caching":http://code.google.com/speed/page-speed/docs/caching.html
* "Revving Filenames: don’t 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.
Expand Down Expand Up @@ -324,7 +322,6 @@ When files are precompiled, Sprockets also creates a "Gzip":http://en.wikipedia.

TODO: Apache instructions


h3. Customizing the Pipeline


Expand Down Expand Up @@ -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+.
Expand Down
2 changes: 0 additions & 2 deletions railties/guides/source/caching_with_rails.textile
Expand Up @@ -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
Expand All @@ -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

Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion railties/guides/source/form_helpers.textile
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions railties/guides/source/getting_started.textile
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion railties/guides/source/i18n.textile
Expand Up @@ -796,7 +796,6 @@ h5. Active Support Methods

* +Array#to_sentence+ uses format settings as given in the "support.array":https://github.com/rails/rails/blob/master/activesupport/lib/active_support/locale/en.yml#L30 scope.


h3. Customize your I18n Setup

h4. Using Different Backends
Expand Down
3 changes: 1 addition & 2 deletions railties/guides/source/initialization.textile
Expand Up @@ -761,7 +761,6 @@ def subclasses
end
</ruby>


The +config+ method used at the top of +I18n::Railtie+ is defined on +Rails::Railtie+ and is defined like this:

<ruby>
Expand Down Expand Up @@ -848,7 +847,7 @@ The +Collection+ class in +railties/lib/rails/initializable.rb+ inherits from +A

The +initializers_chain+ method referenced in the +initializers_for+ method is defined like this:

<rub>
<ruby>
def initializers_chain
initializers = Collection.new
ancestors.reverse_each do | klass |
Expand Down
1 change: 1 addition & 0 deletions railties/guides/source/migrations.textile
Expand Up @@ -300,6 +300,7 @@ change_table :products do |t|
t.rename :upccode, :upc_code
end
</ruby>

removes the +description+ and +name+ columns, creates a +part_number+ column and adds an index on it. Finally it renames the +upccode+ column. This is the same as doing

<ruby>
Expand Down
2 changes: 2 additions & 0 deletions railties/guides/source/plugins.textile
Expand Up @@ -386,6 +386,7 @@ ActiveRecord::Base.send :include, Yaffle::ActsAsYaffle
</ruby>

Run +rake+ one final time and you should see:

<shell>
7 tests, 7 assertions, 0 failures, 0 errors, 0 skips
</shell>
Expand Down Expand Up @@ -426,6 +427,7 @@ require 'yaffle'

You can test this by changing to the Rails application that you added the plugin to and starting a rails console. Once in the
console we can check to see if the String has an instance method of to_squawk.

<shell>
$ cd my_app
$ rails console
Expand Down
1 change: 0 additions & 1 deletion railties/guides/source/security.textile
Expand Up @@ -80,7 +80,6 @@ This will also be a good idea, if you modify the structure of an object and old

* _(highlight)Critical data should not be stored in session_. If the user clears his cookies or closes the browser, they will be lost. And with a client-side session storage, the user can read the data.


h4. Session Storage

-- _Rails provides several storage mechanisms for the session hashes. The most important are ActiveRecordStore and CookieStore._
Expand Down

0 comments on commit 12c0ea9

Please sign in to comment.