From 2cd63ed3af22680ba942085513c6ee5585283326 Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Tue, 23 Jul 2013 19:27:21 +0200 Subject: Updated guides with latest method [ci skip] for blank? --- guides/source/active_support_core_extensions.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 7f65d920df..23246eb72e 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -96,12 +96,13 @@ 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 `ActionDispatch::Session::AbstractStore` uses `blank?` for checking whether a session key is present: +For example, this method from `ActionController::HttpAuthentication::Token::ControllerMethods` uses `blank?` for checking whether a token is present: ```ruby -def ensure_session_key! - if @key.blank? - raise ArgumentError, 'A key is required...' +def authenticate(controller, &login_procedure) + token, options = token_and_options(controller.request) + unless token.blank? + login_procedure.call(token, options) end end ``` -- cgit v1.2.3 From 88667eba4dd2291402ef0fb90237378446a175dd Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Wed, 24 Jul 2013 13:22:40 +0200 Subject: fixed file name references [ci skip] --- guides/source/active_support_core_extensions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 23246eb72e..36d47b9be8 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1988,7 +1988,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/formatting.rb`. +NOTE: Defined in `active_support/core_ext/numeric/conversions.rb`. Extensions to `Integer` ----------------------- @@ -2433,7 +2433,7 @@ dup[1][2] = 4 array[1][2] == nil # => true ``` -NOTE: Defined in `active_support/core_ext/array/deep_dup.rb`. +NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`. ### Grouping @@ -2659,7 +2659,7 @@ hash[:b][:e] == nil # => true hash[:b][:d] == [3, 4] # => true ``` -NOTE: Defined in `active_support/core_ext/hash/deep_dup.rb`. +NOTE: Defined in `active_support/core_ext/object/deep_dup.rb`. ### Diffing @@ -3861,4 +3861,4 @@ rescue NameError => e end ``` -NOTE: Defined in `active_support/core_ext/load_error.rb`. +NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`. -- cgit v1.2.3 From 7e665d2397c550a352503dc9966d576b5ef355e9 Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Wed, 24 Jul 2013 13:33:53 +0200 Subject: Updated guides with latest method [ci skip] --- guides/source/active_support_core_extensions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 36d47b9be8..b3dca3df24 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -3832,13 +3832,13 @@ def default_helper_module! module_path = module_name.underscore helper module_path rescue MissingSourceFile => e - raise e unless e.is_missing? "#{module_path}_helper" + raise e unless e.is_missing? "helpers/#{module_path}_helper" rescue NameError => e raise e unless e.missing_name? "#{module_name}Helper" end ``` -NOTE: Defined in `active_support/core_ext/name_error.rb`. +NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`. Extensions to `LoadError` ------------------------- -- cgit v1.2.3 From 990e8f06f63ce31d7eb34931b2b290a32f12dd20 Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Wed, 24 Jul 2013 13:38:15 +0200 Subject: Removed doc of removed method diff [ci skip] --- guides/source/active_support_core_extensions.md | 38 ------------------------- 1 file changed, 38 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index b3dca3df24..f39fae060e 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2661,44 +2661,6 @@ hash[:b][:d] == [3, 4] # => true NOTE: Defined in `active_support/core_ext/object/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 #### `except` and `except!` -- cgit v1.2.3 From 700c6c65bcce17d4c61423ceaef031bcbe203337 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Wed, 24 Jul 2013 17:23:00 +0200 Subject: Fix the SQLite gem name --- guides/source/development_dependencies_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index 5647a4c1b7..ccbb8ab658 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -59,7 +59,7 @@ $ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel 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-ruby` gem — in Ubuntu you're done with just +Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just ```bash $ sudo apt-get install sqlite3 libsqlite3-dev -- cgit v1.2.3 From 1565821c3432b5723909bf8b3b08d4230efa42f6 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Wed, 24 Jul 2013 18:12:00 +0200 Subject: Add packages list for ArchLinux [ci skip] Add the packages required on Arch Linux when setting up the development dependencies --- guides/source/development_dependencies_install.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'guides/source') diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index ccbb8ab658..d6d8429086 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -57,6 +57,12 @@ 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 lixml2 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 @@ -71,6 +77,12 @@ 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 @@ -137,6 +149,14 @@ $ 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 -- cgit v1.2.3 From 8b8d7f9721497fc8695a653517c0f7573154f29c Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 26 Jul 2013 12:05:42 +0200 Subject: Revert "Fix the SQLite gem name" This reverts commit 700c6c65bcce17d4c61423ceaef031bcbe203337. Bot the `sqlite3` and `sqlite3-ruby` gems exist. https://rubygems.org/gems/sqlite3 https://rubygems.org/gems/sqlite3-ruby In fact, they both point to the same github repository. https://github.com/luislavena/sqlite3-ruby However, the last one hasn't been released since 2011, while the first one keeps getting regular releases. --- guides/source/development_dependencies_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index d6d8429086..d14e8d59dd 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -65,7 +65,7 @@ $ sudo pacman -S lixml2 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 -- cgit v1.2.3 From 3f29a65cd51818e4a5607366ea15f7ef95ba375a Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 26 Jul 2013 12:23:33 +0200 Subject: Refix my misreading of the diff sorry @robin850. Thanks @fxn --- guides/source/development_dependencies_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index d14e8d59dd..d6d8429086 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -65,7 +65,7 @@ $ sudo pacman -S lixml2 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-ruby` gem — in Ubuntu you're done with just +Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just ```bash $ sudo apt-get install sqlite3 libsqlite3-dev -- cgit v1.2.3 From a8d1412a3227ac3d14a40f0e62c9cd83b515ff95 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 26 Jul 2013 15:11:58 +0200 Subject: Add a SQL example for `not` [ci skip] To share a certain logic across other examples, let's add a sample SQL code generated by the given Ruby code --- guides/source/active_record_querying.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 0592821a14..9252a248b2 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -514,7 +514,13 @@ 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. +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) +``` Ordering -------- -- cgit v1.2.3 From 82a2a78be816c16deb191abd72306a3c0aa9859d Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 26 Jul 2013 16:10:03 +0200 Subject: Use hyphenated version of assert_url [ci skip] --- guides/source/upgrading_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index b7ec747a77..656e6d9956 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 ------------------------------------- -- cgit v1.2.3 From 741fdbfcf487180dd51f72bbb37a56d5538a85b4 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 28 Jul 2013 12:19:54 +0200 Subject: Fix lixml2 to libxml2 [ci skip] --- guides/source/development_dependencies_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index d6d8429086..415cedc4d6 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -60,7 +60,7 @@ $ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel If you are running Arch Linux, you're done with: ```bash -$ sudo pacman -S lixml2 libxslt +$ 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) . -- cgit v1.2.3 From b1b589cab603c4d96d01e8de938a2a1534643f1e Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sun, 28 Jul 2013 16:36:26 +0300 Subject: Using markdown-style code quotes --- guides/source/active_support_core_extensions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index f39fae060e..421916d448 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -421,9 +421,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 `Process::Status` class. NOTE: Defined in `active_support/core_ext/object/to_json.rb`. -- cgit v1.2.3 From f14c94dd1a7020afcadbc078a291278ba8c0574f Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sun, 28 Jul 2013 17:01:29 +0300 Subject: Typo fix --- guides/source/active_support_core_extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 421916d448..1915252122 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2046,7 +2046,7 @@ BigDecimal.new(5.00, 6).to_s # => "5.0" ### `to_formatted_s` -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: +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: ```ruby BigDecimal.new(5.00, 6).to_formatted_s # => "5.0" -- cgit v1.2.3