From 6d927fb4da7a0a17d62109b7ef8798a8e75082a7 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:06:47 +0300 Subject: fix a typo --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 1fabb9b99e..9a2c6e4df0 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -20,7 +20,7 @@ In order to understand AJAX, you must first understand what a web broswer does normally. When you type `http://localhost:3000` into your browser's address bar and hit -'Go,' the browser (your 'client') makes a request to the server. It parses the +'Go', the browser (your 'client') makes a request to the server. It parses the response, then fetches all associated assets, like JavaScript files, stylesheets and images. It then assembles the page. If you click a link, it does the same process: fetch the page, fetch the assets, put it all together, -- cgit v1.2.3 From 506257a173bb5cbb083ccae8d1b4ed82a456006a Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:10:11 +0300 Subject: Consistent headlines & ToC I believe the topics and their headlines should be consistent for obvious reasons. Also --- guides/source/working_with_javascript.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 9a2c6e4df0..2099826add 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -5,11 +5,11 @@ This guide covers the built-in Ajax/JavaScript functionality of Rails (and more); it will enable you to create rich and dynamic AJAX applications with ease! We will cover the following topics: -* Quick introduction to AJAX +* An introduction to AJAX * Unobtrusive JavaScript -* How Rails' built-in helpers assist you -* Handling AJAX on the server side -* The Turbolinks gem +* Built-in Helpers +* Server-side concerns +* Turbolinks ------------------------------------------------------------------------------- @@ -246,7 +246,7 @@ this generates Since it's just a `
`, all of the information on `form_for` also applies. -Server side concerns +Server-side concerns -------------------- AJAX isn't just client-side, you also need to do some work on the server -- cgit v1.2.3 From a6d383c8b2afb253c009ad67d31aae3aa8dcc457 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:12:05 +0300 Subject: Improve "request response" term typing & fix a minor typo --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 2099826add..c0220017d3 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -24,7 +24,7 @@ When you type `http://localhost:3000` into your browser's address bar and hit response, then fetches all associated assets, like JavaScript files, stylesheets and images. It then assembles the page. If you click a link, it does the same process: fetch the page, fetch the assets, put it all together, -show you the results. This is called the 'request response cycle.' +show you the results. This is called the 'Request-Response cycle'. JavaScript can also make requests to the server, and parse the response. It also has the ability to update information on the page. Combining these two -- cgit v1.2.3 From 1332cf53af981d0a7a6f801edd9632eb5c118a3f Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:15:44 +0300 Subject: Explain where the acronym AJAX stands for & replace "JavaScript writer" with "JavaScript developer" --- guides/source/working_with_javascript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index c0220017d3..ece3b7647c 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -28,9 +28,9 @@ show you the results. This is called the 'Request-Response cycle'. JavaScript can also make requests to the server, and parse the response. It also has the ability to update information on the page. Combining these two -powers, a JavaScript writer can make a web page that can update just parts of +powers, a JavaScript developer can make a web page that can update just parts of itself, without needing to get the full page data from the server. This is a -powerful technique that we call AJAX. +powerful technique that we call AJAX, which stands for Asynchronous JavaScript and XML. Rails ships with CoffeeScript by default, and so the rest of the examples in this guide will be in CoffeeScript. All of these lessons, of course, apply -- cgit v1.2.3 From 507e522e26b4073455b2337bcf1670e52bba5429 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:19:06 +0300 Subject: Improve grammar a bit --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index ece3b7647c..7ec489f23a 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -119,7 +119,7 @@ $(document).ready -> We call this 'unobtrusive' JavaScript because we're no longer mixing our JavaScript into our HTML. We've properly separated our concerns, making future -change easy. We can easily add behavior to any link by adding the data +changes easier. We can easily add behavior to any link by adding the data attribute. We can run all of our JavaScript through a minimizer and concatenator. We can serve our entire JavaScript bundle on every page, which means that it'll get downloaded on the first page load and then be cached on -- cgit v1.2.3 From 00332733b2bf83b22dd57a18a5a61217ce7cfe5f Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:21:50 +0300 Subject: Improve grammar --- guides/source/working_with_javascript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 7ec489f23a..dba6a68940 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -136,8 +136,8 @@ Rails provides a bunch of view helper methods written in Ruby to assist you in generating HTML. Sometimes, you want to add a little AJAX to those elements, and Rails has got your back in those cases. -Because of Unobtrusive JavaScript, the Rails "AJAX helpers" are actually in two -parts: the JavaScript half and the Ruby half. +Because of Unobtrusive JavaScript, the Rails AJAX helpers actually consist of two +parts: the JavaScript part and the Ruby part. [rails.js](https://github.com/rails/jquery-ujs/blob/master/src/rails.js) provides the JavaScript half, and the regular Ruby view helpers add appropriate tags to your DOM. The CoffeeScript in rails.js then listens for these -- cgit v1.2.3 From 2767f01be05e3714b250f8c2743b7f5e1b0833ac Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Sun, 21 Oct 2012 17:23:22 +0300 Subject: Fix a typo --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index dba6a68940..2758564a93 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -146,7 +146,7 @@ attributes, and attaches appropriate handlers. ### form_for [`form_for`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for) -is a helper that assists with writing ``s. `form_for` takes a `:remote` +is a helper that assists with writing forms. `form_for` takes a `:remote` option. It works like this: ``` -- cgit v1.2.3 From d279d3e165de1bcdb51fd673e043f2c68d21501d Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 21 Oct 2012 17:48:40 +0300 Subject: Wrap a piece of code to a code block --- guides/source/working_with_javascript.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 2758564a93..cbdf5c79de 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -216,7 +216,9 @@ You can bind to the same AJAX events as `form_for`. Here's an example. Let's assume that we have a resource `/fib/:n` that calculates the `n`th Fibonacci number. We would generate some HTML like this: +``` <%= link_to "Calculate", "/fib/15", remote: true, data: { fib: 15 } %> +``` and write some CoffeeScript like this: -- cgit v1.2.3 From 67ec9b7c4e63e3597859440e2a2e4c5c71dbd875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Fride=CC=81n?= Date: Sun, 21 Oct 2012 17:36:02 +0200 Subject: Fixes typo. --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index cbdf5c79de..c33fa8864c 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -16,7 +16,7 @@ ease! We will cover the following topics: An introduction to AJAX ------------------------ -In order to understand AJAX, you must first understand what a web broswer does +In order to understand AJAX, you must first understand what a web browser does normally. When you type `http://localhost:3000` into your browser's address bar and hit -- cgit v1.2.3 From 2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Mon, 22 Oct 2012 14:27:55 -0500 Subject: fix output messages - docs [ci skip] --- .../source/active_record_validations_callbacks.md | 4 +-- guides/source/active_support_core_extensions.md | 36 +++++++++++----------- guides/source/active_support_instrumentation.md | 4 +-- guides/source/i18n.md | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 7555ef4226..5c27ccbf9e 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -736,7 +736,7 @@ end person = Person.new person.valid? # => false person.errors - # => {name: ["can't be blank", "is too short (minimum is 3 characters)"]} + # => {:name=>["can't be blank", "is too short (minimum is 3 characters)"]} person = Person.new(name: "John Doe") person.valid? # => true @@ -1003,7 +1003,7 @@ Callbacks can also be registered to only fire on certain lifecycle events: ```ruby class User < ActiveRecord::Base before_validation :normalize_name, on: :create - + # :on takes an array as well after_validation :set_location, on: [ :create, :update ] diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index c08ad1ee90..e7ed62ef47 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2372,7 +2372,7 @@ This method is similar in purpose to `Kernel#Array`, but there are some differen The last point is particularly worth comparing for some enumerables: ```ruby -Array.wrap(foo: :bar) # => [{foo: :bar}] +Array.wrap(foo: :bar) # => [{:foo=>:bar}] Array(foo: :bar) # => [[:foo, :bar]] ``` @@ -2557,7 +2557,7 @@ Ruby has a built-in method `Hash#merge` that merges two hashes: ```ruby {a: 1, b: 1}.merge(a: 0, c: 2) -# => {a: 0, b: 1, c: 2} +# => {:a=>0, :b=>1, :c=>2} ``` Active Support defines a few more ways of merging hashes that may be convenient. @@ -2602,7 +2602,7 @@ Active Support defines `Hash#deep_merge`. In a deep merge, if a key is found in ```ruby {a: {b: 1}}.deep_merge(a: {c: 2}) -# => {a: {b: 1, c: 2}} +# => {:a=>{:b=>1, :c=>2}} ``` The method `deep_merge!` performs a deep merge in place. @@ -2641,17 +2641,17 @@ The method `diff` returns a hash that represents a diff of the receiver and the # => {}, first rule {a: 1}.diff(a: 2) -# => {a: 1}, second rule +# => {:a=>1}, second rule {a: 1}.diff(b: 2) -# => {a: 1, b: 2}, third rule +# => {:a=>1, :b=>2}, third rule {a: 1, b: 2, c: 3}.diff(b: 1, c: 3, d: 4) -# => {a: 1, b: 2, d: 4}, all rules +# => {:a=>1, :b=>2, :d=>4}, all rules {}.diff({}) # => {} -{a: 1}.diff({}) # => {a: 1} -{}.diff(a: 1) # => {a: 1} +{a: 1}.diff({}) # => {:a=>1} +{}.diff(a: 1) # => {:a=>1} ``` An important property of this diff hash is that you can retrieve the original hash by applying `diff` twice: @@ -2671,7 +2671,7 @@ NOTE: Defined in `active_support/core_ext/hash/diff.rb`. The method `except` returns a hash with the keys in the argument list removed, if present: ```ruby -{a: 1, b: 2}.except(:a) # => {b: 2} +{a: 1, b: 2}.except(:a) # => {:b=>2} ``` If the receiver responds to `convert_key`, the method is called on each of the arguments. This allows `except` to play nice with hashes with indifferent access for instance: @@ -2776,7 +2776,7 @@ The method `symbolize_keys` returns a hash that has a symbolized version of the ```ruby {nil => nil, 1 => 1, "a" => "a"}.symbolize_keys -# => {1 => 1, nil => nil, a: "a"} +# => {1=>1, nil=>nil, :a=>"a"} ``` WARNING. Note in the previous example only one key was symbolized. @@ -2785,7 +2785,7 @@ The result in case of collision is undefined: ```ruby {"a" => 1, a: 2}.symbolize_keys -# => {a: 2}, in my test, can't rely on this result though +# => {:a=>2}, in my test, can't rely on this result though ``` This method may be useful for example to easily accept both symbols and strings as options. For instance `ActionController::UrlRewriter` defines @@ -2836,17 +2836,17 @@ Ruby has built-in support for taking slices out of strings and arrays. Active Su ```ruby {a: 1, b: 2, c: 3}.slice(:a, :c) -# => {c: 3, a: 1} +# => {:c=>3, :a=>1} {a: 1, b: 2, c: 3}.slice(:b, :X) -# => {b: 2} # non-existing keys are ignored +# => {:b=>2} # non-existing keys are ignored ``` If the receiver responds to `convert_key` keys are normalized: ```ruby {a: 1, b: 2}.with_indifferent_access.slice("a") -# => {a: 1} +# => {:a=>1} ``` NOTE. Slicing may come in handy for sanitizing option hashes with a white list of keys. @@ -2855,8 +2855,8 @@ There's also `slice!` which in addition to perform a slice in place returns what ```ruby hash = {a: 1, b: 2} -rest = hash.slice!(:a) # => {b: 2} -hash # => {a: 1} +rest = hash.slice!(:a) # => {:b=>2} +hash # => {:a=>1} ``` NOTE: Defined in `active_support/core_ext/hash/slice.rb`. @@ -2867,8 +2867,8 @@ The method `extract!` removes and returns the key/value pairs matching the given ```ruby hash = {a: 1, b: 2} -rest = hash.extract!(:a) # => {a: 1} -hash # => {b: 2} +rest = hash.extract!(:a) # => {:a=>1} +hash # => {:b=>2} ``` The method `extract!` returns the same subclass of Hash, that the receiver is. diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index b35691bbcc..1163940f10 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -434,7 +434,7 @@ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*a event.name # => "process_action.action_controller" event.duration # => 10 (in milliseconds) - event.payload # => { extra: :information } + event.payload # => {:extra=>information} Rails.logger.info "#{event} Received!" end @@ -477,7 +477,7 @@ Now you can listen to this event with: ```ruby ActiveSupport::Notifications.subscribe "my.custom.event" do |name, started, finished, unique_id, data| - puts data.inspect # { this: :data } + puts data.inspect # {:this=>:data} end ``` diff --git a/guides/source/i18n.md b/guides/source/i18n.md index e916bda630..9d8287ab7c 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -546,7 +546,7 @@ Also, a key can translate to a (potentially nested) hash of grouped translations ```ruby I18n.t 'activerecord.errors.messages' -# => { inclusion: "is not included in the list", exclusion: ... } +# => {:inclusion=>"is not included in the list", :exclusion=> ... } ``` #### "Lazy" Lookup -- cgit v1.2.3 From 276e7b0a1d4b6b742733ee5b5c7dde4dd37a5e11 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Wed, 24 Oct 2012 10:47:07 -0500 Subject: Update upgrading notes: users should stop using :concat and :cache options in asset tags --- guides/source/3_1_release_notes.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guides/source') diff --git a/guides/source/3_1_release_notes.md b/guides/source/3_1_release_notes.md index 1d79ea5b5a..d3f8abe0c8 100644 --- a/guides/source/3_1_release_notes.md +++ b/guides/source/3_1_release_notes.md @@ -129,6 +129,10 @@ config.static_cache_control = "public, max-age=3600" end ``` +#### Remove :cache and :concat options in asset helpers references in views + +* With the Asset Pipeline the :cache and :concat options aren't used anymore, delete these options from your views. + Creating a Rails 3.1 application -------------------------------- -- cgit v1.2.3 From 53568e05a3a9610de2f391f932ecc3700fc9a665 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Wed, 24 Oct 2012 10:51:11 -0500 Subject: Update Upgrading Guide with removal of :cache and :concat options --- guides/source/upgrading_ruby_on_rails.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guides/source') diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index d57bb1f8bc..05a1714966 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -271,3 +271,7 @@ or ```bash $ rake db:sessions:clear ``` + +### Remove :cache and :concat options in asset helpers references in views + +* With the Asset Pipeline the :cache and :concat options aren't used anymore, delete these options from your views. -- cgit v1.2.3 From 6250873d965f9cd6982b62b73c4f4835463e8261 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Wed, 24 Oct 2012 10:58:04 -0500 Subject: With the Asset Pipeline the :cache and :concat options aren't used anymore --- guides/source/asset_pipeline.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'guides/source') diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index fc0092a93e..0540516a74 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -386,6 +386,9 @@ generates something like this: ``` +Note: with the Asset Pipeline the :cache and :concat options aren't used anymore, delete these options from the `javascript_include_tag` and `stylesheet_link_tag`. + + The fingerprinting behavior is controlled by the setting of `config.assets.digest` setting in Rails (which defaults to `true` for production and `false` for everything else). NOTE: Under normal circumstances the default option should not be changed. If there are no digests in the filenames, and far-future headers are set, remote clients will never know to refetch the files when their content changes. -- cgit v1.2.3 From 0f45570b9657e3ef40a0536f4455fe19ced96ce8 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 24 Oct 2012 22:51:20 +0200 Subject: Revert "Consistent headlines & ToC" This reverts commit 506257a173bb5cbb083ccae8d1b4ed82a456006a. --- guides/source/working_with_javascript.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index c33fa8864c..b1eeca25e8 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -5,11 +5,11 @@ This guide covers the built-in Ajax/JavaScript functionality of Rails (and more); it will enable you to create rich and dynamic AJAX applications with ease! We will cover the following topics: -* An introduction to AJAX +* Quick introduction to AJAX * Unobtrusive JavaScript -* Built-in Helpers -* Server-side concerns -* Turbolinks +* How Rails' built-in helpers assist you +* Handling AJAX on the server side +* The Turbolinks gem ------------------------------------------------------------------------------- @@ -248,7 +248,7 @@ this generates Since it's just a ``, all of the information on `form_for` also applies. -Server-side concerns +Server side concerns -------------------- AJAX isn't just client-side, you also need to do some work on the server -- cgit v1.2.3 From 7cbce8505442414fa7e0f01c9556f060c235b30e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 24 Oct 2012 22:51:58 +0200 Subject: Revert "fix a typo" This reverts commit 6d927fb4da7a0a17d62109b7ef8798a8e75082a7. --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index b1eeca25e8..9ff0716433 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -20,7 +20,7 @@ In order to understand AJAX, you must first understand what a web browser does normally. When you type `http://localhost:3000` into your browser's address bar and hit -'Go', the browser (your 'client') makes a request to the server. It parses the +'Go,' the browser (your 'client') makes a request to the server. It parses the response, then fetches all associated assets, like JavaScript files, stylesheets and images. It then assembles the page. If you click a link, it does the same process: fetch the page, fetch the assets, put it all together, -- cgit v1.2.3 From c8dec40c5e2b41cd9b60bfe591504549c6bd5387 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 24 Oct 2012 22:52:18 +0200 Subject: Revert "Improve "request response" term typing & fix a minor typo" This reverts commit a6d383c8b2afb253c009ad67d31aae3aa8dcc457. --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 9ff0716433..15435691fa 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -24,7 +24,7 @@ When you type `http://localhost:3000` into your browser's address bar and hit response, then fetches all associated assets, like JavaScript files, stylesheets and images. It then assembles the page. If you click a link, it does the same process: fetch the page, fetch the assets, put it all together, -show you the results. This is called the 'Request-Response cycle'. +show you the results. This is called the 'request response cycle.' JavaScript can also make requests to the server, and parse the response. It also has the ability to update information on the page. Combining these two -- cgit v1.2.3 From fe470411c60836448ce88819ecbbf01adc527a1e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 24 Oct 2012 22:52:43 +0200 Subject: Revert "Explain where the acronym AJAX stands for & replace "JavaScript writer" with "JavaScript developer"" This reverts commit 1332cf53af981d0a7a6f801edd9632eb5c118a3f. --- guides/source/working_with_javascript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 15435691fa..33860c6f25 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -28,9 +28,9 @@ show you the results. This is called the 'request response cycle.' JavaScript can also make requests to the server, and parse the response. It also has the ability to update information on the page. Combining these two -powers, a JavaScript developer can make a web page that can update just parts of +powers, a JavaScript writer can make a web page that can update just parts of itself, without needing to get the full page data from the server. This is a -powerful technique that we call AJAX, which stands for Asynchronous JavaScript and XML. +powerful technique that we call AJAX. Rails ships with CoffeeScript by default, and so the rest of the examples in this guide will be in CoffeeScript. All of these lessons, of course, apply -- cgit v1.2.3 From 4fee5dfed2200b3f5b2b90b14f9e0c0a7e925b35 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 24 Oct 2012 22:52:59 +0200 Subject: Revert "Improve grammar a bit" This reverts commit 507e522e26b4073455b2337bcf1670e52bba5429. --- guides/source/working_with_javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/working_with_javascript.md b/guides/source/working_with_javascript.md index 33860c6f25..106744d605 100644 --- a/guides/source/working_with_javascript.md +++ b/guides/source/working_with_javascript.md @@ -119,7 +119,7 @@ $(document).ready -> We call this 'unobtrusive' JavaScript because we're no longer mixing our JavaScript into our HTML. We've properly separated our concerns, making future -changes easier. We can easily add behavior to any link by adding the data +change easy. We can easily add behavior to any link by adding the data attribute. We can run all of our JavaScript through a minimizer and concatenator. We can serve our entire JavaScript bundle on every page, which means that it'll get downloaded on the first page load and then be cached on -- cgit v1.2.3 From cc5dfccddab6b08b924799cca8be8edd17d479af Mon Sep 17 00:00:00 2001 From: Henrik N Date: Thu, 25 Oct 2012 13:45:32 +0200 Subject: AJAX -> Ajax in layouts_and_rendering guide. Fixed in the JS guide in 8c38172ba59e16d8e523ac4f1c5ae29b6851d3ee --- guides/source/layouts_and_rendering.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'guides/source') diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 8277859232..5f4f7e8511 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -124,7 +124,7 @@ Cache-Control: no-cache $ ``` -We see there is an empty response (no data after the `Cache-Control` line), but the request was successful because Rails has set the response to 200 OK. You can set the `:status` option on render to change this response. Rendering nothing can be useful for AJAX requests where all you want to send back to the browser is an acknowledgment that the request was completed. +We see there is an empty response (no data after the `Cache-Control` line), but the request was successful because Rails has set the response to 200 OK. You can set the `:status` option on render to change this response. Rendering nothing can be useful for Ajax requests where all you want to send back to the browser is an acknowledgment that the request was completed. TIP: You should probably be using the `head` method, discussed later in this guide, instead of `render :nothing`. This provides additional flexibility and makes it explicit that you're only generating HTTP headers. @@ -259,13 +259,13 @@ You can send plain text - with no markup at all - back to the browser by using t render :text => "OK" ``` -TIP: Rendering pure text is most useful when you're responding to AJAX or web service requests that are expecting something other than proper HTML. +TIP: Rendering pure text is most useful when you're responding to Ajax or web service requests that are expecting something other than proper HTML. NOTE: By default, if you use the `:text` option, the text is rendered without using the current layout. If you want Rails to put the text into the current layout, you need to add the `:layout => true` option. #### Rendering JSON -JSON is a JavaScript data format used by many AJAX libraries. Rails has built-in support for converting objects to JSON and rendering that JSON back to the browser: +JSON is a JavaScript data format used by many Ajax libraries. Rails has built-in support for converting objects to JSON and rendering that JSON back to the browser: ```ruby render :json => @product -- cgit v1.2.3 From 65be1a0e7a93b2f4e308739d55516be0c58543df Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 25 Oct 2012 20:05:14 -0500 Subject: encourage use of Ruby 1.9 syntax [ci skip] --- guides/source/contributing_to_ruby_on_rails.md | 1 + 1 file changed, 1 insertion(+) (limited to 'guides/source') diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 6e843062ec..6d63697047 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -205,6 +205,7 @@ TIP: Changes that are cosmetic in nature and do not add anything substantial to Rails follows a simple set of coding style conventions. +* Use Ruby >= 1.9 syntax. Prefer `{ a: :b }` over `{ :a => :b }`. * Two spaces, no tabs (for indentation). * No trailing whitespace. Blank lines should not have any spaces. * Indent after private/protected. -- cgit v1.2.3 From b1e5c1660b40688993f3ed151143a26da55082db Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Fri, 26 Oct 2012 14:56:37 +0200 Subject: Fix a pair of typos on Active Record Querying guide --- guides/source/active_record_querying.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 76548a3397..da56d55deb 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1087,7 +1087,7 @@ Scopes Scoping allows you to specify commonly-used queries which can be referenced as method calls on the association objects or models. With these scopes, you can use every method previously covered such as `where`, `joins` and `includes`. All scope methods will return an `ActiveRecord::Relation` object which will allow for further methods (such as other scopes) to be called on it. -To define a simple scope, we use the `scope` method inside the class, passing the query that we'd like run when this scope is called: +To define a simple scope, we use the `scope` method inside the class, passing the query that we'd like to run when this scope is called: ```ruby class Post < ActiveRecord::Base @@ -1256,7 +1256,7 @@ creating a new record, but we don't want to include it in the query. So we want to find the client named "Andy", or if that client doesn't exist, create a client named "Andy" which is not locked. -We can achive this in two ways. The first is to use `create_with`: +We can achieve this in two ways. The first is to use `create_with`: ```ruby Client.create_with(locked: false).find_or_create_by(first_name: 'Andy') -- cgit v1.2.3 From cc81af2fe438fd3e2c8f95dae8f757de0bab1b53 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Fri, 26 Oct 2012 23:18:34 +0300 Subject: Use a better word --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 824ffb5d7a..dd8d229e6a 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -66,7 +66,7 @@ class ClientsController < ActionController::Base if params[:status] == "activated" @clients = Client.activated else - @clients = Client.unactivated + @clients = Client.inactivated end end -- cgit v1.2.3 From c570ba70fe6ed53fd1ac5f30f0c9ba4cb7cd4796 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Sat, 27 Oct 2012 21:54:44 +0100 Subject: Changed comment section to be more explicit. I had an issue with rolling back a migration and couldn't understand why 'rake db:reset' didn't work. --- guides/source/migrations.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 3eeb45f8c6..314ee3f5cd 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -684,8 +684,9 @@ version to migrate to. The `rake db:reset` task will drop the database, recreate it and load the current schema into it. -NOTE: This is not the same as running all the migrations - see the section on -[schema.rb](#schema-dumping-and-you). +NOTE: This is not the same as running all the migrations. It will only use the contents +of the current schema.rb file. If a migration can't be rolled back, 'rake db:reset' +may not help you. To find out more about dumping the schema see [schema.rb](#schema-dumping-and-you). ### Running Specific Migrations -- cgit v1.2.3 From 0d7dcdcbf4e212fd53ed6c836022db05d0a8229a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Mon, 29 Oct 2012 11:27:35 +0100 Subject: 3.1 and up, in configuring guide. --- guides/source/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/configuring.md b/guides/source/configuring.md index ab2766054b..0b4f183d61 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -133,7 +133,7 @@ These configuration methods are to be called on a `Rails::Railtie` object, such ### 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. +Rails 3.1 and up, 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. * `config.assets.enabled` a flag that controls whether the asset pipeline is enabled. It is explicitly initialized in `config/application.rb`. -- cgit v1.2.3 From ee917493e451e552fef18367f8bcba2f36080685 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 3 Nov 2012 01:41:44 +0530 Subject: copy edits [ci skip] --- guides/source/contributing_to_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 6d63697047..3791467584 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -205,10 +205,10 @@ TIP: Changes that are cosmetic in nature and do not add anything substantial to Rails follows a simple set of coding style conventions. -* Use Ruby >= 1.9 syntax. Prefer `{ a: :b }` over `{ :a => :b }`. * Two spaces, no tabs (for indentation). * No trailing whitespace. Blank lines should not have any spaces. * Indent after private/protected. +* Use Ruby >= 1.9 syntax for hashes. Prefer `{ a: :b }` over `{ :a => :b }`. * Prefer `&&`/`||` over `and`/`or`. * Prefer class << self over self.method for class methods. * Use `MyClass.my_method(my_arg)` not `my_method( my_arg )` or `my_method my_arg`. -- cgit v1.2.3