aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/upgrading_ruby_on_rails.md
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-08-07 16:10:20 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-08-07 16:10:20 -0700
commit089661b69ad055cab68ea860c085c7f852da3972 (patch)
treea39fe35f3c399b199bdca8490724b451761a1cba /guides/source/upgrading_ruby_on_rails.md
parentcc1de71bfaced172fe00a66fd381da69d9528e8b (diff)
parente81453ef92b37156dafc092093106c8e8b87b268 (diff)
downloadrails-089661b69ad055cab68ea860c085c7f852da3972.tar.gz
rails-089661b69ad055cab68ea860c085c7f852da3972.tar.bz2
rails-089661b69ad055cab68ea860c085c7f852da3972.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'guides/source/upgrading_ruby_on_rails.md')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md32
1 files changed, 32 insertions, 0 deletions
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
-------------------------------------