diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-08-17 21:38:53 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-08-17 21:46:39 +0530 |
commit | ec8ef1e1055c4e1598da13f49d30261f07f4a9b4 (patch) | |
tree | d5450558358174f6963323061e25366246ff5801 /guides | |
parent | dba4c6fe539c24ec1beb106e34f37f3cd0632022 (diff) | |
download | rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.tar.gz rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.tar.bz2 rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.zip |
Revert "Merge branch 'master' of github.com:rails/docrails"
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.
Seems to be a code merge done by mistake.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/_welcome.html.erb | 2 | ||||
-rw-r--r-- | guides/source/action_mailer_basics.md | 2 | ||||
-rw-r--r-- | guides/source/action_view_overview.md | 2 | ||||
-rw-r--r-- | guides/source/active_record_querying.md | 8 | ||||
-rw-r--r-- | guides/source/active_support_core_extensions.md | 65 | ||||
-rw-r--r-- | guides/source/command_line.md | 11 | ||||
-rw-r--r-- | guides/source/development_dependencies_install.md | 22 | ||||
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 2 |
8 files changed, 62 insertions, 52 deletions
diff --git a/guides/source/_welcome.html.erb b/guides/source/_welcome.html.erb index 0a0a958e30..9210c40c17 100644 --- a/guides/source/_welcome.html.erb +++ b/guides/source/_welcome.html.erb @@ -15,7 +15,7 @@ </p> <% end %> <p> - The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.14/">http://guides.rubyonrails.org/v3.2.14/</a>. + The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.13/">http://guides.rubyonrails.org/v3.2.13/</a>. </p> <p> The guides for Rails 2.3.x are available at <a href="http://guides.rubyonrails.org/v2.3.11/">http://guides.rubyonrails.org/v2.3.11/</a>. diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index d5a8ce4bf9..bf34799eb3 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -105,7 +105,7 @@ will be the template used for the email, formatted in HTML: <h1>Welcome to example.com, <%= @user.name %></h1> <p> You have successfully signed up to example.com, - your username is: <%= @user.login %>.<br> + your username is: <%= @user.login %>.<br/> </p> <p> To login to the site, just follow this link: <%= @url %>. diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index f4218994ae..3542844f33 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -68,7 +68,7 @@ Consider the following loop for names: ```html+erb <h1>Names of all the people</h1> <% @people.each do |person| %> - Name: <%= person.name %><br> + Name: <%= person.name %><br/> <% end %> ``` diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 9252a248b2..0592821a14 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -514,13 +514,7 @@ SELECT * FROM clients WHERE (clients.orders_count IN (1,3,5)) Post.where.not(author: author) ``` -In other words, this query can be generated by calling `where` with no argument, -then immediately chain with `not` passing `where` conditions. This will generate -SQL code like this: - -```sql -SELECT * FROM posts WHERE (author_id != 1) -``` +In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions. Ordering -------- diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index be5e47584e..ca023f7f66 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -96,13 +96,12 @@ INFO: The predicate for strings uses the Unicode-aware character class `[:space: WARNING: Note that numbers are not mentioned. In particular, 0 and 0.0 are **not** blank. -For example, this method from `ActionController::HttpAuthentication::Token::ControllerMethods` uses `blank?` for checking whether a token is present: +For example, this method from `ActionDispatch::Session::AbstractStore` uses `blank?` for checking whether a session key is present: ```ruby -def authenticate(controller, &login_procedure) - token, options = token_and_options(controller.request) - unless token.blank? - login_procedure.call(token, options) +def ensure_session_key! + if @key.blank? + raise ArgumentError, 'A key is required...' end end ``` @@ -421,9 +420,9 @@ NOTE: Defined in `active_support/core_ext/object/with_options.rb`. ### JSON support -Active Support provides a better implemention of `to_json` than the `json` gem ordinarily provides for Ruby objects. This is because some classes, like `Hash` and `OrderedHash` needs special handling in order to provide a proper JSON representation. +Active Support provides a better implemention of `to_json` than the +json+ gem ordinarily provides for Ruby objects. This is because some classes, like +Hash+ and +OrderedHash+ needs special handling in order to provide a proper JSON representation. -Active Support also provides an implementation of `as_json` for the `Process::Status` class. +Active Support also provides an implementation of `as_json` for the <tt>Process::Status</tt> class. NOTE: Defined in `active_support/core_ext/object/to_json.rb`. @@ -2000,7 +1999,7 @@ Produce a string representation of a number in human-readable words: 1234567890123456.to_s(:human) # => "1.23 Quadrillion" ``` -NOTE: Defined in `active_support/core_ext/numeric/conversions.rb`. +NOTE: Defined in `active_support/core_ext/numeric/formatting.rb`. Extensions to `Integer` ----------------------- @@ -2058,7 +2057,7 @@ BigDecimal.new(5.00, 6).to_s # => "5.0" ### `to_formatted_s` -The method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation: +Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation: ```ruby BigDecimal.new(5.00, 6).to_formatted_s # => "5.0" @@ -2445,7 +2444,7 @@ dup[1][2] = 4 array[1][2] == nil # => true ``` -NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`. +NOTE: Defined in `active_support/core_ext/array/deep_dup.rb`. ### Grouping @@ -2671,7 +2670,45 @@ hash[:b][:e] == nil # => true hash[:b][:d] == [3, 4] # => true ``` -NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`. +NOTE: Defined in `active_support/core_ext/hash/deep_dup.rb`. + +### Diffing + +The method `diff` returns a hash that represents a diff of the receiver and the argument with the following logic: + +* Pairs `key`, `value` that exist in both hashes do not belong to the diff hash. + +* If both hashes have `key`, but with different values, the pair in the receiver wins. + +* The rest is just merged. + +```ruby +{a: 1}.diff(a: 1) +# => {}, first rule + +{a: 1}.diff(a: 2) +# => {:a=>1}, second rule + +{a: 1}.diff(b: 2) +# => {: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 + +{}.diff({}) # => {} +{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: + +```ruby +hash.diff(hash2).diff(hash2) == hash +``` + +Diffing hashes may be useful for error messages related to expected option hashes for example. + +NOTE: Defined in `active_support/core_ext/hash/diff.rb`. ### Working with Keys @@ -3806,13 +3843,13 @@ def default_helper_module! module_path = module_name.underscore helper module_path rescue MissingSourceFile => e - raise e unless e.is_missing? "helpers/#{module_path}_helper" + raise e unless e.is_missing? "#{module_path}_helper" rescue NameError => e raise e unless e.missing_name? "#{module_name}Helper" end ``` -NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`. +NOTE: Defined in `active_support/core_ext/name_error.rb`. Extensions to `LoadError` ------------------------- @@ -3835,4 +3872,4 @@ rescue NameError => e end ``` -NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`. +NOTE: Defined in `active_support/core_ext/load_error.rb`. diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 18c4b1f366..5f98326c57 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -381,13 +381,12 @@ About your application's environment Ruby version 1.9.3 (x86_64-linux) RubyGems version 1.3.6 Rack version 1.3 -Rails version 4.1.0 +Rails version 4.0.0 JavaScript Runtime Node.js (V8) -Active Record version 4.1.0 -Action Pack version 4.1.0 -Action View version 4.1.0 -Action Mailer version 4.1.0 -Active Support version 4.1.0 +Active Record version 4.0.0 +Action Pack version 4.0.0 +Action Mailer version 4.0.0 +Active Support version 4.0.0 Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd131a7c88>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::EncryptedCookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag Application root /home/foobar/commandsapp Environment development diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index 415cedc4d6..5647a4c1b7 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -57,15 +57,9 @@ If you are on Fedora or CentOS, you can run $ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel ``` -If you are running Arch Linux, you're done with: - -```bash -$ sudo pacman -S libxml2 libxslt -``` - If you have any problems with these libraries, you can install them manually by compiling the source code. Just follow the instructions at the [Red Hat/CentOS section of the Nokogiri tutorials](http://nokogiri.org/tutorials/installing_nokogiri.html#red_hat__centos) . -Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just +Also, SQLite3 and its development files for the `sqlite3-ruby` gem — in Ubuntu you're done with just ```bash $ sudo apt-get install sqlite3 libsqlite3-dev @@ -77,12 +71,6 @@ And if you are on Fedora or CentOS, you're done with $ sudo yum install sqlite3 sqlite3-devel ``` -If you are on Arch Linux, you will need to run: - -```bash -$ sudo pacman -S sqlite -``` - Get a recent version of [Bundler](http://gembundler.com/) ```bash @@ -149,14 +137,6 @@ $ sudo yum install mysql-server mysql-devel $ sudo yum install postgresql-server postgresql-devel ``` -If you are running Arch Linux, MySQL isn't supported anymore so you will need to -use MariaDB instead (see [this announcement](https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/)): - -```bash -$ sudo pacman -S mariadb libmariadbclient mariadb-clients -$ sudo pacman -S postgresql postgresql-libs -``` - After that, run: ```bash diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 656e6d9956..b7ec747a77 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -322,7 +322,7 @@ config.assets.js_compressor = :uglifier ### sass-rails -* `asset-url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")` +* `asset_url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")` Upgrading from Rails 3.1 to Rails 3.2 ------------------------------------- |