Hello community, here is the log from the commit of package rubygem-rails-4_2 for openSUSE:Factory checked in at 2015-07-08 07:24:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rails-4_2 (Old) and /work/SRC/openSUSE:Factory/.rubygem-rails-4_2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rails-4_2" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rails-4_2/rubygem-rails-4_2.changes 2015-03-29 20:18:04.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-rails-4_2.new/rubygem-rails-4_2.changes 2015-07-08 07:25:00.000000000 +0200 @@ -1,0 +2,16 @@ +Fri Jun 26 04:34:58 UTC 2015 - [email protected] + +- updated to version 4.2.3 + see installed CHANGELOG.md + +------------------------------------------------------------------- +Wed Jun 17 04:39:27 UTC 2015 - [email protected] + +- updated to version 4.2.2 + see installed CHANGELOG.md + + ## Rails 4.2.2 (June 16, 2014) ## + + * No Changes * + +------------------------------------------------------------------- Old: ---- rails-4.2.1.gem New: ---- rails-4.2.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rails-4_2.spec ++++++ --- /var/tmp/diff_new_pack.HcQwxh/_old 2015-07-08 07:25:01.000000000 +0200 +++ /var/tmp/diff_new_pack.HcQwxh/_new 2015-07-08 07:25:01.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-rails-4_2 -Version: 4.2.1 +Version: 4.2.3 Release: 0 %define mod_name rails %define mod_full_name %{mod_name}-%{version} ++++++ rails-4.2.1.gem -> rails-4.2.3.gem ++++++ Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/CHANGELOG.md new/guides/CHANGELOG.md --- old/guides/CHANGELOG.md 2015-03-19 17:41:51.000000000 +0100 +++ new/guides/CHANGELOG.md 2015-06-25 23:30:36.000000000 +0200 @@ -1,8 +1,18 @@ -## Rails 4.2.1 (March 19, 2014) ## +## Rails 4.2.3 (June 25, 2015) ## * No Changes * +## Rails 4.2.2 (June 16, 2015) ## + +* No Changes * + + +## Rails 4.2.1 (March 19, 2015) ## + +* No changes. + + ## Rails 4.2.0 (December 20, 2014) ## * New guide about constant autoloading and reloading. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/bug_report_templates/generic_gem.rb new/guides/bug_report_templates/generic_gem.rb --- old/guides/bug_report_templates/generic_gem.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/guides/bug_report_templates/generic_gem.rb 2015-06-25 23:30:36.000000000 +0200 @@ -0,0 +1,15 @@ +# Activate the gems you are reporting the issue against. +gem 'activesupport', '4.2.0' +require 'active_support' +require 'active_support/core_ext/object/blank' +require 'minitest/autorun' + +# Ensure backward compatibility with Minitest 4 +Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) + +class BugTest < Minitest::Test + def test_stuff + assert "zomg".present? + refute "".present? + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/bug_report_templates/generic_master.rb new/guides/bug_report_templates/generic_master.rb --- old/guides/bug_report_templates/generic_master.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/guides/bug_report_templates/generic_master.rb 2015-06-25 23:30:36.000000000 +0200 @@ -0,0 +1,26 @@ +unless File.exist?('Gemfile') + File.write('Gemfile', <<-GEMFILE) + source 'https://rubygems.org' + gem 'rails', github: 'rails/rails' + gem 'arel', github: 'rails/arel' + GEMFILE + + system 'bundle' +end + +require 'bundler' +Bundler.setup(:default) + +require 'active_support' +require 'active_support/core_ext/object/blank' +require 'minitest/autorun' + +# Ensure backward compatibility with Minitest 4 +Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) + +class BugTest < Minitest::Test + def test_stuff + assert "zomg".present? + refute "".present? + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/rails_guides/levenshtein.rb new/guides/rails_guides/levenshtein.rb --- old/guides/rails_guides/levenshtein.rb 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/rails_guides/levenshtein.rb 2015-06-25 23:30:36.000000000 +0200 @@ -7,11 +7,9 @@ t = str2 n = s.length m = t.length - max = n/2 return m if (0 == n) return n if (0 == m) - return n if (n - m).abs > max d = (0..m).to_a x = nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/4_2_release_notes.md new/guides/source/4_2_release_notes.md --- old/guides/source/4_2_release_notes.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/4_2_release_notes.md 2015-06-25 23:30:36.000000000 +0200 @@ -300,6 +300,30 @@ assert_select('p', 'AT&T') # => false ``` +Furthermore substitutions have changed syntax. + +Now you have to use a `:match` CSS-like selector: + +```ruby +assert_select ":match('id', ?)", 'comment_1' +``` + +Additionally Regexp substitutions look different when the assertion fails. +Notice how `/hello/` here: + +```ruby +assert_select(":match('id', ?)", /hello/) +``` + +becomes `"(?-mix:hello)"`: + +``` +Expected at least 1 element matching "div:match('id', "(?-mix:hello)")", found 0.. +Expected 0 to be >= 1. +``` + +See the [Rails Dom Testing](https://github.com/rails/rails-dom-testing/tree/8798b9349fb9540ad8cb9a0ce6cb88d1384a210b) documentation for more on `assert_select`. + Railties -------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/action_mailer_basics.md new/guides/source/action_mailer_basics.md --- old/guides/source/action_mailer_basics.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/action_mailer_basics.md 2015-06-25 23:30:36.000000000 +0200 @@ -507,6 +507,9 @@ <%= user_url(@user, host: 'example.com') %> ``` +NOTE: non-`GET` links require [jQuery UJS](https://github.com/rails/jquery-ujs) +and won't work in mailer templates. They will result in normal `GET` requests. + ### Sending Multipart Emails Action Mailer will automatically send multipart emails if you have different @@ -670,7 +673,7 @@ | Configuration | Description | |---------------|-------------| |`logger`|Generates information on the mailing run if available. Can be set to `nil` for no logging. Compatible with both Ruby's own `Logger` and `Log4r` loggers.| -|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:<ul><li>`:address` - Allows you to use a remote mail server. Just change it from its default `"localhost"` setting.</li><li>`:port` - On the off chance that your mail server doesn't run on port 25, you can change it.</li><li>`:domain` - If you need to specify a HELO domain, you can do it here.</li><li>`:user_name` - If your mail server requires authentication, set the username in this setting.</li><li>`:password` - If your mail server requires authentication, set the password in this setting.</li><li>`:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain`, `:login`, `:cram_md5`.</li><li>`:enable_starttls_auto` - Set this to `false` if there is a problem with your server certificate that you cannot resolve.</li></ul>| +|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:<ul><li>`:address` - Allows you to use a remote mail server. Just change it from its default `"localhost"` setting.</li><li>`:port` - On the off chance that your mail server doesn't run on port 25, you can change it.</li><li>`:domain` - If you need to specify a HELO domain, you can do it here.</li><li>`:user_name` - If your mail server requires authentication, set the username in this setting.</li><li>`:password` - If your mail server requires authentication, set the password in this setting.</li><li>`:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain` (will send the password in the clear), `:login` (will send password Base64 encoded) or `:cram_md5` (combines a Challenge/Response mechanism to exchange information and a cryptographic Message Digest 5 algorithm to hash important information)</li><li>`:enable_starttls_auto` - Detects if STARTTLS is enabled in your SMTP server and starts to use it. Defaults to `true`.</li><li>`:openssl_verify_mode` - When using TLS, you can set how OpenSSL checks the certificate. This is really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name of an OpenSSL verify constant ('none', 'peer', 'client_once', 'fail_if_no_peer_cert') or directly the constant (`OpenSSL::SSL::VERIFY_NONE`, `OpenSSL::SSL::VERIFY_PEER`, ...).</li></ul>| |`sendmail_settings`|Allows you to override options for the `:sendmail` delivery method.<ul><li>`:location` - The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.</li><li>`:arguments` - The command line arguments to be passed to sendmail. Defaults to `-i -t`.</li></ul>| |`raise_delivery_errors`|Whether or not errors should be raised if the email fails to be delivered. This only works if the external email server is configured for immediate delivery.| |`delivery_method`|Defines a delivery method. Possible values are:<ul><li>`:smtp` (default), can be configured by using `config.action_mailer.smtp_settings`.</li><li>`:sendmail`, can be configured by using `config.action_mailer.sendmail_settings`.</li><li>`:file`: save emails to files; can be configured by using `config.action_mailer.file_settings`.</li><li>`:test`: save emails to `ActionMailer::Base.deliveries` array.</li></ul>See [API docs](http://api.rubyonrails.org/classes/ActionMailer/Base.html) for more info.| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/action_view_overview.md new/guides/source/action_view_overview.md --- old/guides/source/action_view_overview.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/action_view_overview.md 2015-06-25 23:30:36.000000000 +0200 @@ -435,39 +435,13 @@ image_tag("rails.png") # => <img src="http://assets.example.com/images/rails.png" alt="Rails" /> ``` -#### register_javascript_expansion - -Register one or more JavaScript files to be included when symbol is passed to javascript_include_tag. This method is typically intended to be called from plugin initialization to register JavaScript files that the plugin installed in `vendor/assets/javascripts`. - -```ruby -ActionView::Helpers::AssetTagHelper.register_javascript_expansion monkey: ["head", "body", "tail"] - -javascript_include_tag :monkey # => - <script src="/assets/head.js"></script> - <script src="/assets/body.js"></script> - <script src="/assets/tail.js"></script> -``` - -#### 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 `vendor/assets/stylesheets`. - -```ruby -ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion monkey: ["head", "body", "tail"] - -stylesheet_link_tag :monkey # => - <link href="/assets/head.css" media="screen" rel="stylesheet" /> - <link href="/assets/body.css" media="screen" rel="stylesheet" /> - <link href="/assets/tail.css" media="screen" rel="stylesheet" /> -``` - #### auto_discovery_link_tag Returns a link tag that browsers and feed readers can use to auto-detect an RSS or Atom feed. ```ruby -auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "RSS Feed"}) # => - <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed" /> +auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", { title: "RSS Feed" }) # => + <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed.rss" /> ``` #### image_path @@ -1420,22 +1394,6 @@ Provides functionality for working with JavaScript in your views. -#### button_to_function - -Returns a button that'll trigger a JavaScript function using the onclick handler. Examples: - -```ruby -button_to_function "Greeting", "alert('Hello world!')" -button_to_function "Delete", "if (confirm('Really?')) do_delete()" -button_to_function "Details" do |page| - page[:details].visual_effect :toggle_slide -end -``` - -#### define_javascript_functions - -Includes the Action Pack JavaScript libraries inside a single `script` tag. - #### escape_javascript Escape carrier returns and single and double quotes for JavaScript segments. @@ -1456,15 +1414,6 @@ </script> ``` -#### link_to_function - -Returns a link that will trigger a JavaScript function using the onclick handler and return false after the fact. - -```ruby -link_to_function "Greeting", "alert('Hello world!')" -# => <a onclick="alert('Hello world!'); return false;" href="#">Greeting</a> -``` - ### NumberHelper Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, and file size. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/active_record_basics.md new/guides/source/active_record_basics.md --- old/guides/source/active_record_basics.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/active_record_basics.md 2015-06-25 23:30:36.000000000 +0200 @@ -171,18 +171,18 @@ ```ruby class Product < ActiveRecord::Base - self.table_name = "PRODUCT" + self.table_name = "my_products" end ``` If you do so, you will have to define manually the class name that is hosting -the fixtures (class_name.yml) using the `set_fixture_class` method in your test +the fixtures (my_products.yml) using the `set_fixture_class` method in your test definition: ```ruby -class FunnyJoke < ActiveSupport::TestCase - set_fixture_class funny_jokes: Joke - fixtures :funny_jokes +class ProductTest < ActiveSupport::TestCase + set_fixture_class my_products: Product + fixtures :my_products ... end ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/active_record_querying.md new/guides/source/active_record_querying.md --- old/guides/source/active_record_querying.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/active_record_querying.md 2015-06-25 23:30:36.000000000 +0200 @@ -876,7 +876,7 @@ Item.transaction do i = Item.lock.first i.name = 'Jones' - i.save + i.save! end ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/active_support_core_extensions.md new/guides/source/active_support_core_extensions.md --- old/guides/source/active_support_core_extensions.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/active_support_core_extensions.md 2015-06-25 23:30:36.000000000 +0200 @@ -3043,53 +3043,6 @@ NOTE: Defined in `active_support/core_ext/range/overlaps.rb`. -Extensions to `Proc` --------------------- - -### `bind` - -As you surely know Ruby has an `UnboundMethod` class whose instances are methods that belong to the limbo of methods without a self. The method `Module#instance_method` returns an unbound method for example: - -```ruby -Hash.instance_method(:delete) # => #<UnboundMethod: Hash#delete> -``` - -An unbound method is not callable as is, you need to bind it first to an object with `bind`: - -```ruby -clear = Hash.instance_method(:clear) -clear.bind({a: 1}).call # => {} -``` - -Active Support defines `Proc#bind` with an analogous purpose: - -```ruby -Proc.new { size }.bind([]).call # => 0 -``` - -As you see that's callable and bound to the argument, the return value is indeed a `Method`. - -NOTE: To do so `Proc#bind` actually creates a method under the hood. If you ever see a method with a weird name like `__bind_1256598120_237302` in a stack trace you know now where it comes from. - -Action Pack uses this trick in `rescue_from` for example, which accepts the name of a method and also a proc as callbacks for a given rescued exception. It has to call them in either case, so a bound method is returned by `handler_for_rescue`, thus simplifying the code in the caller: - -```ruby -def handler_for_rescue(exception) - _, rescuer = Array(rescue_handlers).reverse.detect do |klass_name, handler| - ... - end - - case rescuer - when Symbol - method(rescuer) - when Proc - rescuer.bind(self) - end -end -``` - -NOTE: Defined in `active_support/core_ext/proc.rb`. - Extensions to `Date` -------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/asset_pipeline.md new/guides/source/asset_pipeline.md --- old/guides/source/asset_pipeline.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/asset_pipeline.md 2015-06-25 23:30:36.000000000 +0200 @@ -789,41 +789,6 @@ } ``` -#### GZip Compression - -When files are precompiled, Sprockets also creates a -[gzipped](http://en.wikipedia.org/wiki/Gzip) (.gz) version of your assets. Web -servers are typically configured to use a moderate compression ratio as a -compromise, but since precompilation happens once, Sprockets uses the maximum -compression ratio, thus reducing the size of the data transfer to the minimum. -On the other hand, web servers can be configured to serve compressed content -directly from disk, rather than deflating non-compressed files themselves. - -NGINX is able to do this automatically enabling `gzip_static`: - -```nginx -location ~ ^/(assets)/ { - root /path/to/public; - gzip_static on; # to serve pre-gzipped version - expires max; - add_header Cache-Control public; -} -``` - -This directive is available if the core module that provides this feature was -compiled with the web server. Ubuntu/Debian packages, even `nginx-light`, have -the module compiled. Otherwise, you may need to perform a manual compilation: - -```bash -./configure --with-http_gzip_static_module -``` - -If you're compiling NGINX with Phusion Passenger you'll need to pass that option -when prompted. - -A robust configuration for Apache is possible but tricky; please Google around. -(Or help update this Guide if you have a good configuration example for Apache.) - ### Local Precompilation There are several reasons why you might want to precompile your assets locally. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/association_basics.md new/guides/source/association_basics.md --- old/guides/source/association_basics.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/association_basics.md 2015-06-25 23:30:36.000000000 +0200 @@ -1417,7 +1417,13 @@ ##### `collection.clear` -The `collection.clear` method removes every object from the collection. This destroys the associated objects if they are associated with `dependent: :destroy`, deletes them directly from the database if `dependent: :delete_all`, and otherwise sets their foreign keys to `NULL`. +The `collection.clear` method removes all objects from the collection according to the strategy specified by the `dependent` option. If no option is given, it follows the default strategy. The default strategy for `has_many :through` associations is `delete_all`, and for `has_many` associations is to set the foreign keys to `NULL`. + +```ruby [email protected] +``` + +WARNING: Objects will be delete if they're associated with `dependent: :destroy`, just like `dependent: :delete_all`. ##### `collection.empty?` @@ -1456,7 +1462,9 @@ ##### `collection.exists?(...)` -The `collection.exists?` method checks whether an object meeting the supplied conditions exists in the collection. It uses the same syntax and options as `ActiveRecord::Base.exists?`. +The `collection.exists?` method checks whether an object meeting the supplied +conditions exists in the collection. It uses the same syntax and options as +[`ActiveRecord::Base.exists?`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-exists-3F). ##### `collection.build(attributes = {}, ...)` @@ -1949,7 +1957,9 @@ ##### `collection.exists?(...)` -The `collection.exists?` method checks whether an object meeting the supplied conditions exists in the collection. It uses the same syntax and options as `ActiveRecord::Base.exists?`. +The `collection.exists?` method checks whether an object meeting the supplied +conditions exists in the collection. It uses the same syntax and options as +[`ActiveRecord::Base.exists?`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-exists-3F). ##### `collection.build(attributes = {})` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/autoloading_and_reloading_constants.md new/guides/source/autoloading_and_reloading_constants.md --- old/guides/source/autoloading_and_reloading_constants.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/autoloading_and_reloading_constants.md 2015-06-25 23:30:36.000000000 +0200 @@ -461,8 +461,9 @@ by adding this to `config/application.rb`: ```ruby -config.autoload_paths += "#{Rails.root}/lib" +config.autoload_paths << "#{Rails.root}/lib" ``` +`config.autoload_paths` is accessible from environment-specific configuration files, but any changes made to it outside `config/application.rb` don't have an effect. The value of `autoload_paths` can be inspected. In a just generated application it is (edited): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/engines.md new/guides/source/engines.md --- old/guides/source/engines.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/engines.md 2015-06-25 23:30:36.000000000 +0200 @@ -589,7 +589,7 @@ right now, you would see this error: ``` -Missing partial blorgh/comments/comment with {:handlers=>[:erb, :builder], +Missing partial blorgh/comments/_comment with {:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}. Searched in: * "/Users/ryan/Sites/side_projects/blorgh/test/dummy/app/views" * "/Users/ryan/Sites/side_projects/blorgh/app/views" @@ -598,7 +598,7 @@ The engine is unable to find the partial required for rendering the comments. Rails looks first in the application's (`test/dummy`) `app/views` directory and then in the engine's `app/views` directory. When it can't find it, it will throw -this error. The engine knows to look for `blorgh/comments/comment` because the +this error. The engine knows to look for `blorgh/comments/_comment` because the model object it is receiving is from the `Blorgh::Comment` class. This partial will be responsible for rendering just the comment text, for now. @@ -696,8 +696,8 @@ something such as this: ```bash -Copied migration [timestamp_1]_create_blorgh_articles.rb from blorgh -Copied migration [timestamp_2]_create_blorgh_comments.rb from blorgh +Copied migration [timestamp_1]_create_blorgh_articles.blorgh.rb from blorgh +Copied migration [timestamp_2]_create_blorgh_comments.blorgh.rb from blorgh ``` The first timestamp (`[timestamp_1]`) will be the current time, and the second @@ -829,11 +829,9 @@ two migrations were copied over the first time this command was run. ``` -NOTE Migration [timestamp]_create_blorgh_articles.rb from blorgh has been -skipped. Migration with the same name already exists. NOTE Migration -[timestamp]_create_blorgh_comments.rb from blorgh has been skipped. Migration -with the same name already exists. Copied migration -[timestamp]_add_author_id_to_blorgh_articles.rb from blorgh +NOTE Migration [timestamp]_create_blorgh_articles.blorgh.rb from blorgh has been skipped. Migration with the same name already exists. +NOTE Migration [timestamp]_create_blorgh_comments.blorgh.rb from blorgh has been skipped. Migration with the same name already exists. +Copied migration [timestamp]_add_author_id_to_blorgh_articles.blorgh.rb from blorgh ``` Run the migration using: @@ -888,7 +886,9 @@ `app/controllers/blorgh/application_controller.rb` to look like: ```ruby -class Blorgh::ApplicationController < ApplicationController +module Blorgh + class ApplicationController < ::ApplicationController + end end ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/getting_started.md new/guides/source/getting_started.md --- old/guides/source/getting_started.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/getting_started.md 2015-06-25 23:30:36.000000000 +0200 @@ -123,7 +123,7 @@ $ rails --version ``` -If it says something like "Rails 4.2.0", you are ready to continue. +If it says something like "Rails 4.2.1", you are ready to continue. ### Creating the Blog Application @@ -318,9 +318,9 @@ application to the welcome controller's index action and `get 'welcome/index'` tells Rails to map requests to <http://localhost:3000/welcome/index> to the welcome controller's index action. This was created earlier when you ran the -controller generator (`rails generate controller welcome index`). +controller generator (`bin/rails generate controller welcome index`). -Launch the web server again if you stopped it to generate the controller (`rails +Launch the web server again if you stopped it to generate the controller (`bin/rails server`) and navigate to <http://localhost:3000> in your browser. You'll see the "Hello, Rails!" message you put into `app/views/welcome/index.html.erb`, indicating that this new route is indeed going to `WelcomeController`'s `index` @@ -353,7 +353,7 @@ end ``` -If you run `rake routes`, you'll see that it has defined routes for all the +If you run `bin/rake routes`, you'll see that it has defined routes for all the standard RESTful actions. The meaning of the prefix column (and other columns) will be seen later, but for now notice that Rails has inferred the singular form `article` and makes meaningful use of the distinction. @@ -397,7 +397,7 @@ command: ```bash -$ bin/rails g controller articles +$ bin/rails generate controller articles ``` If you open up the newly generated `app/controllers/articles_controller.rb` @@ -551,7 +551,7 @@ In this example, the `articles_path` helper is passed to the `:url` option. To see what Rails will do with this, we look back at the output of -`rake routes`: +`bin/rake routes`: ```bash $ bin/rake routes @@ -661,7 +661,7 @@ ### Running a Migration -As we've just seen, `rails generate model` created a _database migration_ file +As we've just seen, `bin/rails generate model` created a _database migration_ file inside the `db/migrate` directory. Migrations are Ruby classes that are designed to make it simple to create and modify database tables. Rails uses rake commands to run migrations, and it's possible to undo a migration after @@ -714,7 +714,7 @@ command will apply to the database defined in the `development` section of your `config/database.yml` file. If you would like to execute migrations in another environment, for instance in production, you must explicitly pass it when -invoking the command: `rake db:migrate RAILS_ENV=production`. +invoking the command: `bin/rake db:migrate RAILS_ENV=production`. ### Saving data in the controller @@ -801,7 +801,7 @@ `show` action. That's not very useful though, so let's add the `show` action before proceeding. -As we have seen in the output of `rake routes`, the route for `show` action is +As we have seen in the output of `bin/rake routes`, the route for `show` action is as follows: ``` @@ -831,7 +831,7 @@ def new end - # snipped for brevity + # snippet for brevity ``` A couple of things to note. We use `Article.find` to find the article we're @@ -863,7 +863,7 @@ ### Listing all articles We still need a way to list all our articles, so let's do that. -The route for this as per output of `rake routes` is: +The route for this as per output of `bin/rake routes` is: ``` articles GET /articles(.:format) articles#index @@ -887,7 +887,7 @@ def new end - # snipped for brevity + # snippet for brevity ``` And then finally, add the view for this action, located at @@ -1357,7 +1357,7 @@ We're now ready to cover the "D" part of CRUD, deleting articles from the database. Following the REST convention, the route for -deleting articles as per output of `rake routes` is: +deleting articles as per output of `bin/rake routes` is: ```ruby DELETE /articles/:id(.:format) articles#destroy @@ -1993,7 +1993,7 @@ @articles = Article.all end - # snipped for brevity + # snippet for brevity ``` We also want to allow only authenticated users to delete comments, so in the @@ -2009,7 +2009,7 @@ # ... end - # snipped for brevity + # snippet for brevity ``` Now if you try to create a new article, you will be greeted with a basic HTTP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/i18n.md new/guides/source/i18n.md --- old/guides/source/i18n.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/i18n.md 2015-06-25 23:30:36.000000000 +0200 @@ -685,7 +685,7 @@ ```erb <%# This is safe, it is going to be escaped if needed. %> -<%= t('welcome_html', username: @current_user.username %> +<%= t('welcome_html', username: @current_user.username) %> ``` Safe strings on the other hand are interpolated verbatim. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/initialization.md new/guides/source/initialization.md --- old/guides/source/initialization.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/initialization.md 2015-06-25 23:30:36.000000000 +0200 @@ -161,7 +161,7 @@ is called. ```ruby -COMMAND_WHITELIST = %(plugin generate destroy console server dbconsole application runner new version help) +COMMAND_WHITELIST = %w(plugin generate destroy console server dbconsole application runner new version help) def run_command!(command) command = parse_command(command) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/routing.md new/guides/source/routing.md --- old/guides/source/routing.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/routing.md 2015-06-25 23:30:36.000000000 +0200 @@ -805,6 +805,18 @@ NOTE: For the curious, `'articles#index'` actually expands out to `ArticlesController.action(:index)`, which returns a valid Rack application. +If you specify a rack application as the endpoint for a matcher remember that the route will be unchanged in the receiving application. With the following route your rack application should expect the route to be '/admin': + +```ruby +match '/admin', to: AdminApp, via: :all +``` + +If you would prefer to have your rack application receive requests at the root path instead use mount: + +```ruby +mount AdminApp, at: '/admin' +``` + ### Using `root` You can specify what Rails should route `'/'` to with the `root` method: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guides/source/upgrading_ruby_on_rails.md new/guides/source/upgrading_ruby_on_rails.md --- old/guides/source/upgrading_ruby_on_rails.md 2015-03-19 17:41:52.000000000 +0100 +++ new/guides/source/upgrading_ruby_on_rails.md 2015-06-25 23:30:36.000000000 +0200 @@ -838,6 +838,20 @@ * To re-enable the old finders, you can use the [activerecord-deprecated_finders gem](https://github.com/rails/activerecord-deprecated_finders). +* Rails 4.0 has changed to default join table for `has_and_belongs_to_many` relations to strip the common prefix off the second table name. Any existing `has_and_belongs_to_many` relationship between models with a common prefix must be specified with the `join_table` option. For example: + +```ruby +CatalogCategory < ActiveRecord::Base + has_and_belongs_to_many :catalog_products, join_table: 'catalog_categories_catalog_products' +end + +CatalogProduct < ActiveRecord::Base + has_and_belongs_to_many :catalog_categories, join_table: 'catalog_categories_catalog_products' +end +``` + +* Note that the the prefix takes scopes into account as well, so relations between `Catalog::Category` and `Catalog::Product` or `Catalog::Category` and `CatalogProduct` need to be updated similarly. + ### Active Resource Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile. @@ -881,6 +895,8 @@ * Rails 4.0 has removed the XML parameters parser. You will need to add the `actionpack-xml_parser` gem if you require this feature. +* Rails 4.0 changes the default `layout` lookup set using symbols or procs that return nil. To get the "no layout" behavior, return false instead of nil. + * Rails 4.0 changes the default memcached client from `memcache-client` to `dalli`. To upgrade, simply add `gem 'dalli'` to your `Gemfile`. * Rails 4.0 deprecates the `dom_id` and `dom_class` methods in controllers (they are fine in views). You will need to include the `ActionView::RecordIdentifier` module in controllers requiring this feature. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-03-19 17:41:51.000000000 +0100 +++ new/metadata 2015-06-25 23:30:36.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: rails version: !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 platform: ruby authors: - David Heinemeier Hansson autorequire: bindir: bin cert_chain: [] -date: 2015-03-19 00:00:00.000000000 Z +date: 2015-06-25 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport @@ -16,112 +16,112 @@ requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: actionpack requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: actionview requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: activemodel requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: activerecord requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: actionmailer requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: activejob requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: railties requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.1 + version: 4.2.3 - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement @@ -308,6 +308,8 @@ - guides/bug_report_templates/action_controller_master.rb - guides/bug_report_templates/active_record_gem.rb - guides/bug_report_templates/active_record_master.rb +- guides/bug_report_templates/generic_gem.rb +- guides/bug_report_templates/generic_master.rb - guides/rails_guides.rb - guides/rails_guides/generator.rb - guides/rails_guides/helpers.rb
