# Applying a patch

**URL:** <https://www.ruby-forum.com/t/applying-a-patch/188034>\
**Category:** Rails\
**Created:** [May 4, 2010, 4:16pm UTC](https://www.ruby-forum.com/t/applying-a-patch/188034 "2010-05-04T16:16:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [May 4, 2010, 4:16pm UTC](https://www.ruby-forum.com/t/applying-a-patch/188034/1 "2010-05-04T16:16:09Z")

</div>

Hello,  
I’ve never applied a patch before and would like to know how to do it.

How do I apply the " erb\_encoding\_workaround.patch" from :

[https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038](https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038)

---

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [May 4, 2010, 9:12pm UTC](https://www.ruby-forum.com/t/applying-a-patch/188034/2 "2010-05-04T21:12:34Z")

</div>

Mlle wrote:

> Hello,  
> I’ve never applied a patch before and would like to know how to do it.
> 
> How do I apply the " erb\_encoding\_workaround.patch" from :
> 
> [#2188 Encoding error in Ruby1.9 for templates - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038)

See the man page for the patch command:

> **[patch(1): apply diff file to original - Linux man page](https://linux.die.net/man/1/patch)**
>
> patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions.

git am might also be useful.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [May 6, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/applying-a-patch/188034/3 "2010-05-06T15:30:34Z")

</div>

Mlle wrote:

> Hello,  
> I’ve never applied a patch before and would like to know how to do it.
> 
> How do I apply the " erb\_encoding\_workaround.patch" from :
> 
> [#2188 Encoding error in Ruby1.9 for templates - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038)

> **[How to create and apply a patch with Git · devroom.io](https://www.devroom.io/2009/10/26/how-to-create-and-apply-a-patch-with-git/)**
>
> Ariejan de Vroom's personal website on software engineering, electronics tinkering and car mechanics.

---

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [May 10, 2010, 10:38am UTC](https://www.ruby-forum.com/t/applying-a-patch/188034/4 "2010-05-10T10:38:27Z")

</div>

I put the patch file in my project’s main directory and then tried to  
apply it.

I got these errors:

e:~/Work/samples$ git apply erb\_encoding\_workaround.patch  
erb\_encoding\_workaround.patch :117: trailing whitespace.

error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
file or directory  
error: actionpack/test/fixtures/test/utf8.html.erb: No such file or  
directory  
error: actionpack/test/template/render\_test.rb: No such file or  
directory  
error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
file or directory  
error: actionpack/lib/action\_view/renderable.rb: No such file or  
directory  
error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
file or directory  
error: actionpack/test/fixtures/test/utf8.html.erb: No such file or  
directory  
error: actionpack/test/template/render\_test.rb: No such file or  
directory  
error: activesupport/lib/active\_support/core\_ext/string/multibyte.rb:  
No such file or directory  
error: activesupport/test/core\_ext/string\_ext\_test.rb: No such file or  
directory

Did I put the patch in the right place in order to apply it? Why  
would it get all those errors?

Thanks!

---

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [May 10, 2010, 4:32pm UTC](https://www.ruby-forum.com/t/applying-a-patch/188034/5 "2010-05-10T16:32:12Z")

</div>

Mlle wrote:

> I put the patch file in my project’s main directory and then tried to  
> apply it.
> 
> I got these errors:
> 
> e:~/Work/samples$ git apply erb\_encoding\_workaround.patch  
> erb\_encoding\_workaround.patch :117: trailing whitespace.
> 
> error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
> file or directory  
> error: actionpack/test/fixtures/test/utf8.html.erb: No such file or  
> directory  
> error: actionpack/test/template/render\_test.rb: No such file or  
> directory  
> error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
> file or directory  
> error: actionpack/lib/action\_view/renderable.rb: No such file or  
> directory  
> error: actionpack/lib/action\_view/template\_handlers/erb.rb: No such  
> file or directory  
> error: actionpack/test/fixtures/test/utf8.html.erb: No such file or  
> directory  
> error: actionpack/test/template/render\_test.rb: No such file or  
> directory  
> error: activesupport/lib/active\_support/core\_ext/string/multibyte.rb:  
> No such file or directory  
> error: activesupport/test/core\_ext/string\_ext\_test.rb: No such file or  
> directory
> 
> Did I put the patch in the right place in order to apply it? Why  
> would it get all those errors?

Because the patch is for the Rails library itself, and you’re apparently  
trying to apply it to your project files. As a result, it’s not seeing  
the files it wants to patch, so of course it complains.

> Thanks!

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
