# Doing and storing a Writeboard like diff in RoR

**URL:** <https://www.ruby-forum.com/t/doing-and-storing-a-writeboard-like-diff-in-ror/61044>\
**Category:** Rails\
**Created:** [May 19, 2006, 4:45pm UTC](https://www.ruby-forum.com/t/doing-and-storing-a-writeboard-like-diff-in-ror/61044 "2006-05-19T16:45:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaishal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Vaishal\_S](https://www.ruby-forum.com/u/Vaishal_S)\
**Post date:** [May 19, 2006, 4:45pm UTC](https://www.ruby-forum.com/t/doing-and-storing-a-writeboard-like-diff-in-ror/61044/1 "2006-05-19T16:45:51Z")

</div>

Hello all,

Anyone have any suggestions on how I could do and display a diffed piece  
of  
text in a style similar to Writeboard (strikeouts etc.)

Q1) Are there any ruby gems for diff?  
Q2) How would I represent the diffed text in styled HTML?

If there are existing tools, any ideas on how I could write this?

Thanks,  
Vaishal

---

<div class="post-metadata">

**Author:** ![Vaishal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Vaishal\_S](https://www.ruby-forum.com/u/Vaishal_S)\
**Post date:** [June 4, 2006, 1:20am UTC](https://www.ruby-forum.com/t/doing-and-storing-a-writeboard-like-diff-in-ror/61044/2 "2006-06-04T01:20:57Z")

</div>

Hi,

2006/5/19, Vaishal S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Anyone have any suggestions on how I could do and display a diffed piece of  
> text in a style similar to Writeboard (strikeouts etc.)
> 
> Q1) Are there any ruby gems for diff?  
> Q2) How would I represent the diffed text in styled HTML?

There was a mail here on 3.10.05 from Joe C., I quote it below:

* * *

Just copy the library from here:  
[http://dev.instiki.org/file/instiki/trunk/lib/diff.rb](http://dev.instiki.org/file/instiki/trunk/lib/diff.rb).

Save it under your railsdir/lib as diff.rb  
In your environment.rb add  
require ‘diff’

To use the method in the controller do something like this:  
@diff\_results = HTMLDiff.diff(@object1.text\_to\_compare,  
@object2.text\_to\_compare)

in your view do something like this:  
\<%= @diff\_results %\>

If you want to change the look of the results, add this to your  
stylesheet:

del.diffmod {  
color: #999;  
background-color: #efefef;  
}

ins.diffmod {  
background-color: #cfc;  
text-decoration: none;  
color: #000;  
}

* * *

HTH,  
Beate

---

<div class="post-metadata">

**Author:** ![Vaishal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Vaishal\_S](https://www.ruby-forum.com/u/Vaishal_S)\
**Post date:** [August 5, 2007, 12:06am UTC](https://www.ruby-forum.com/t/doing-and-storing-a-writeboard-like-diff-in-ror/61044/3 "2007-08-05T00:06:04Z")

</div>

diff.rb URL has changed.

[http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/instiki/trunk/lib/diff.rb?root=instiki&view=log](http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/instiki/trunk/lib/diff.rb?root=instiki&view=log)

just posted this so that I can bookmark this page with correct  
information in it 🙂
