diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/4_2_release_notes.md | 58 | ||||
-rw-r--r-- | guides/source/active_job_basics.md | 4 | ||||
-rw-r--r-- | guides/source/development_dependencies_install.md | 84 | ||||
-rw-r--r-- | guides/source/initialization.md | 2 |
4 files changed, 81 insertions, 67 deletions
diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md index 39655447e3..5401b34542 100644 --- a/guides/source/4_2_release_notes.md +++ b/guides/source/4_2_release_notes.md @@ -36,11 +36,11 @@ Major Features ### Active Job, Action Mailer #deliver_later Active Job is a new framework in Rails 4.2. It is an adapter layer on top of -queuing systems like Resque, Delayed Job, Sidekiq, and more. You can write your -jobs to Active Job, and it'll run on all these queues with no changes. (It comes -pre-configured with an inline runner.) +queuing systems like [Resque](https://github.com/resque/resque), [Delayed Job](https://github.com/collectiveidea/delayed_job), [Sidekiq](https://github.com/mperham/sidekiq), and more. You can write your +jobs with the Active Job API, and it'll run on all these queues with no changes +(it comes pre-configured with an inline runner). -Building on top of Active Job, Action Mailer now comes with a #deliver_later +Building on top of Active Job, Action Mailer now comes with a `#deliver_later` method, which adds your email to be sent as a job to a queue, so it doesn't bog down the controller or model. @@ -63,10 +63,20 @@ TODO: add some technical details New applications generated from Rails 4.2 now comes with the Web Console gem by default. -Web Console is an IRB console available in the browser. In development mode, you -can go to /console and do your work right there. It will also be made available -on all exception pages and allows you to jump between the different points in -the backtrace. +Web Console is a set of debugging tools for your Rails application. It will add +an interactive console on every error page, a `console` view helper and a VT100 +compatible terminal. + +The interactive console on the error pages lets you execute code where the +exception originated. It's quite handy to introspect the state that led to the +error. + +The `console` view helper launches an interactive console within the context of +the view where it is invoked. + +Finally, you can launch a VT100 terminal that runs `rails console`. If you need +to create or modify existing test data, you can do that straight from the +browser. ### Foreign key support @@ -174,7 +184,8 @@ Please refer to the [Changelog][railties] for detailed changes. * Introduced an API to register new extensions for `rake notes`. ([Pull Request](https://github.com/rails/rails/pull/14379)) -* Introduced `Rails.gem_version` as a convenience method to return `Gem::Version.new(Rails.version)`. +* Introduced `Rails.gem_version` as a convenience method to return + `Gem::Version.new(Rails.version)`. ([Pull Request](https://github.com/rails/rails/pull/14101)) @@ -255,8 +266,8 @@ Please refer to the [Changelog][action-pack] for detailed changes. * Added HTTP method `MKCALENDAR` from RFC-4791 ([Pull Request](https://github.com/rails/rails/pull/15121)) -* `*_fragment.action_controller` notifications now include the controller and action name - in the payload. +* `*_fragment.action_controller` notifications now include the controller + and action name in the payload. ([Pull Request](https://github.com/rails/rails/pull/14137)) * Segments that are passed into URL helpers are now automatically escaped. @@ -268,6 +279,13 @@ Please refer to the [Changelog][action-pack] for detailed changes. * Added an option to disable logging of CSRF failures. ([Pull Request](https://github.com/rails/rails/pull/14280)) +* When the Rails server is set to serve static assets, gzip assets will now be + served if the client supports it and a pre-generated gzip file (.gz) is on disk. + By default the asset pipeline generates `.gz` files for all compressible assets. + Serving gzip files minimizes data transfer and speeds up asset requests. Always + [use a CDN](http://guides.rubyonrails.org/asset_pipeline.html#cdns) if you are + serving assets from your Rails server in production. + ([Pull Request](https://github.com/rails/rails/pull/16466)) Action View ------------- @@ -317,7 +335,7 @@ Please refer to the [Changelog][action-mailer] for detailed changes. ### Notable changes * Introduced `deliver_later` which enqueues a job on the application's queue - to deliver the mailer asynchronously. + to deliver emails asynchronously. ([Pull Request](https://github.com/rails/rails/pull/16485)) * Added the `show_previews` configuration option for enabling mailer previews @@ -328,9 +346,7 @@ Please refer to the [Changelog][action-mailer] for detailed changes. Active Record ------------- -Please refer to the -[Changelog](https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md) -for detailed changes. +Please refer to the [Changelog][active-record] for detailed changes. ### Removals @@ -346,7 +362,7 @@ for detailed changes. * Removed unused `:timestamp` type. Transparently alias it to `:datetime` in all cases. Fixes inconsistencies when column types are sent outside of - `ActiveRecord`, such as for XML Serialization. + `ActiveRecord`, such as for XML serialization. ([Pull Request](https://github.com/rails/rails/pull/15184)) ### Deprecations @@ -441,7 +457,7 @@ for detailed changes. * `sqlite3:///some/path` now resolves to the absolute system path `/some/path`. For relative paths, use `sqlite3:some/path` instead. (Previously, `sqlite3:///some/path` resolved to the relative path - `some/path`. This behaviour was deprecated on Rails 4.1.) + `some/path`. This behaviour was deprecated on Rails 4.1). ([Pull Request](https://github.com/rails/rails/pull/14569)) * Introduced `#validate` as an alias for `#valid?`. @@ -473,17 +489,19 @@ Please refer to the [Changelog][active-model] for detailed changes. ### Deprecations -* Deprecated reset_#{attribute} in favor of restore_#{attribute}. +* Deprecated `reset_#{attribute}` in favor of `restore_#{attribute}`. ([Pull Request](https://github.com/rails/rails/pull/16180)) -* Deprecated ActiveModel::Dirty#reset_changes in favor of #clear_changes_information. +* Deprecated `ActiveModel::Dirty#reset_changes` in favor of + `#clear_changes_information`. ([Pull Request](https://github.com/rails/rails/pull/16180)) ### Notable changes * Introduced the `restore_attributes` method in `ActiveModel::Dirty` to restore the changed (dirty) attributes to their previous values. - (Pull Request [1](https://github.com/rails/rails/pull/14861), [2](https://github.com/rails/rails/pull/16180)) + (Pull Request [1](https://github.com/rails/rails/pull/14861), + [2](https://github.com/rails/rails/pull/16180)) * `has_secure_password` no longer disallow blank passwords (i.e. passwords that contains only spaces) by default. diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 4632ea1faf..e2f13d557a 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -67,7 +67,7 @@ Here's what a job looks like: class GuestsCleanupJob < ActiveJob::Base queue_as :default - def perform + def perform(*args) # Do something later end end @@ -269,7 +269,7 @@ job: class GuestsCleanupJob < ActiveJob::Base queue_as :default - rescue_from(ActiveRecord:NotFound) do |exception| + rescue_from(ActiveRecord::RecordNotFound) do |exception| # do something with the exception end diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index 54b4230e16..3d9ec578ae 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -45,36 +45,14 @@ $ cd rails The test suite must pass with any submitted code. No matter whether you are writing a new patch, or evaluating someone else's, you need to be able to run the tests. -Install first libxml2 and libxslt together with their development files for Nokogiri. In Ubuntu that's +Install first SQLite3 and its development files for the `sqlite3` gem. Mac OS X +users are done with: ```bash -$ sudo apt-get install libxml2 libxml2-dev libxslt1-dev +$ brew install sqlite3 ``` -If you are on Fedora or CentOS, you can run - -```bash -$ 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 -``` - -On FreeBSD, you just have to run: - -```bash -# pkg_add -r libxml2 libxslt -``` - -Alternatively, you can install the `textproc/libxml2` and `textproc/libxslt` -ports. - -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 +In Ubuntu you're done with just: ```bash $ sudo apt-get install sqlite3 libsqlite3-dev @@ -95,7 +73,7 @@ $ sudo pacman -S sqlite For FreeBSD users, you're done with: ```bash -# pkg_add -r sqlite3 +# pkg install sqlite3 ``` Or compile the `databases/sqlite3` port. @@ -117,7 +95,7 @@ This command will install all dependencies except the MySQL and PostgreSQL Ruby NOTE: If you would like to run the tests that use memcached, you need to ensure that you have it installed and running. -You can use [Homebrew](http://brew.sh/) to install memcached on OSX: +You can use [Homebrew](http://brew.sh/) to install memcached on OS X: ```bash $ brew install memcached @@ -135,6 +113,20 @@ Or use yum on Fedora or CentOS: $ sudo yum install memcached ``` +If you are running on Arch Linux: + +```bash +$ sudo pacman -S memcached +``` + +For FreeBSD users, you're done with: + +```bash +# pkg install memcached +``` + +Alternatively, you can compile the `databases/memcached` port. + With the dependencies now installed, you can run the test suite with: ```bash @@ -181,7 +173,19 @@ The Active Record test suite requires a custom config file: `activerecord/test/c #### MySQL and PostgreSQL -To be able to run the suite for MySQL and PostgreSQL we need their gems. Install first the servers, their client libraries, and their development files. In Ubuntu just run +To be able to run the suite for MySQL and PostgreSQL we need their gems. Install +first the servers, their client libraries, and their development files. + +On OS X, you can run: + +```bash +$ brew install mysql +$ brew install postgresql +``` + +Follow the instructions given by Homebrew to start these. + +In Ubuntu just run: ```bash $ sudo apt-get install mysql-server libmysqlclient15-dev @@ -206,17 +210,9 @@ $ sudo pacman -S postgresql postgresql-libs FreeBSD users will have to run the following: ```bash -# pkg_add -r mysql56-client mysql56-server -# pkg_add -r postgresql92-client postgresql92-server -``` - -You can use [Homebrew](http://brew.sh/) to install MySQL and PostgreSQL on OSX: - -```bash -$ brew install mysql -$ brew install postgresql +# pkg install mysql56-client mysql56-server +# pkg install postgresql93-client postgresql93-server ``` -Follow instructions given by [Homebrew](http://brew.sh/) to start these. Or install them through ports (they are located under the `databases` folder). If you run into troubles during the installation of MySQL, please see @@ -252,18 +248,20 @@ $ cd activerecord $ bundle exec rake db:mysql:build ``` -PostgreSQL's authentication works differently. A simple way to set up the development environment for example is to run with your development account -This is not needed when installed via [Homebrew](http://brew.sh). +PostgreSQL's authentication works differently. To setup the development environment +with your development account, on Linux or BSD, you just have to run: ```bash $ sudo -u postgres createuser --superuser $USER ``` -And for OS X (when installed via [Homebrew](http://brew.sh)) + +and for OS X: + ```bash $ createuser --superuser $USER ``` -and then create the test databases with +Then you need to create the test databases with ```bash $ cd activerecord diff --git a/guides/source/initialization.md b/guides/source/initialization.md index b81b048c35..53bf3039fa 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -111,7 +111,6 @@ A standard Rails application depends on several gems, specifically: * i18n * mail * mime-types -* polyglot * rack * rack-cache * rack-mount @@ -121,7 +120,6 @@ A standard Rails application depends on several gems, specifically: * rake * sqlite3 * thor -* treetop * tzinfo ### `rails/commands.rb` |