aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorStefan Kanev <stefan.kanev@gmail.com>2014-08-05 19:38:20 +0300
committerStefan Kanev <stefan.kanev@gmail.com>2014-08-05 19:38:48 +0300
commitc294e91d00696e910e05ad1428ba3ce4884bc6a3 (patch)
tree30b07e641538f8efc0265d698183485163ec17b7 /guides/source
parent097b2101897af447591d00fb2809d91894572b87 (diff)
downloadrails-c294e91d00696e910e05ad1428ba3ce4884bc6a3.tar.gz
rails-c294e91d00696e910e05ad1428ba3ce4884bc6a3.tar.bz2
rails-c294e91d00696e910e05ad1428ba3ce4884bc6a3.zip
Add after_bundle to the release notes and upgrade guide
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/4_2_release_notes.md3
-rw-r--r--guides/source/upgrading_ruby_on_rails.md32
2 files changed, 35 insertions, 0 deletions
diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md
index 12db528b91..a39dd9ace0 100644
--- a/guides/source/4_2_release_notes.md
+++ b/guides/source/4_2_release_notes.md
@@ -85,6 +85,9 @@ Please refer to the [Changelog][railties] for detailed changes.
* Introduced `Rails.gem_version` as a convenience method to return `Gem::Version.new(Rails.version)`.
([Pull Request](https://github.com/rails/rails/pull/14101))
+* Introduced an `after_bundle` callback in the Rails templates.
+ ([Pull Request](https://github.com/rails/rails/pull/16359))
+
Action Pack
-----------
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index b3e4505fc0..62e4071935 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -58,6 +58,38 @@ When assigning `nil` to a serialized attribute, it will be saved to the database
as `NULL` instead of passing the `nil` value through the coder (e.g. `"null"`
when using the `JSON` coder).
+### `after_bundle` in Rails templates
+
+If you have a Rails template that adds all the files in version control, it
+fails to add the generated binstubs because it gets executed before Bundler:
+
+```ruby
+# template.rb
+generate(:scaffold, "person name:string")
+route "root to: 'people#index'"
+rake("db:migrate")
+
+git :init
+git add: "."
+git commit: %Q{ -m 'Initial commit' }
+```
+
+You can now wrap the `git` calls in an `after_bundle` block. It will be run
+after the binstubs have been generated.
+
+```ruby
+# template.rb
+generate(:scaffold, "person name:string")
+route "root to: 'people#index'"
+rake("db:migrate")
+
+after_bundle do
+ git :init
+ git add: "."
+ git commit: %Q{ -m 'Initial commit' }
+end
+```
+
Upgrading from Rails 4.0 to Rails 4.1
-------------------------------------