# \[ANN\] History plugin

**URL:** <https://www.ruby-forum.com/t/ann-history-plugin/95440>\
**Category:** Rails\
**Created:** [June 1, 2006, 12:34pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440 "2006-06-01T12:34:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 1, 2006, 12:34pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/1 "2006-06-01T12:34:54Z")

</div>

Hello,

I felt annoyed enough when having to redirect user back to their  
previous location in a hackish way that I wrote this plugin.

It avoids storing POST and Ajax request. It also has a facility to  
specify actions not to store in the history.

If you are interested, it’s there:  
[http://blog.cosinux.org/pages/rails-history](http://blog.cosinux.org/pages/rails-history)

See you all,

Damien

–  
Damien MERENNE [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://blog.cosinux.org/](http://blog.cosinux.org/)

If you ask Chuck Norris what time it is, he always says, “Two seconds  
'til.”  
After you ask, “Two seconds 'til what?” he roundhouse kicks you in the  
face.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 1, 2006, 11:26pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/2 "2006-06-01T23:26:05Z")

</div>

On Jun 1, 2006, at 12:33, Damien MERENNE wrote:

> [http://blog.cosinux.org/pages/rails-history](http://blog.cosinux.org/pages/rails-history)  
> Cool!

Looked to me like a good plugin to explain those metaprogramming  
idioms. I blogged about it here:

[Advogato: Blog for fxn](http://advogato.org/person/fxn/diary.html?start=441)

– fxn

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 2, 2006, 9:20am UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/3 "2006-06-02T09:20:59Z")

</div>

On Thu, Jun 01, 2006 at 11:23:26PM +0200, Xavier N. wrote:

> Looked to me like a good plugin to explain those metaprogramming  
> idioms. I blogged about it here:
> 
> [Advogato: Blog for fxn](http://advogato.org/person/fxn/diary.html?start=441)

Thank you very much! I did not thought it could serve as tutorial.  
Great article.

–  
Damien MERENNE [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://blog.cosinux.org/](http://blog.cosinux.org/)

Chuck Norris is currently suing NBC, claiming Law and Order are  
trademarked names for his left and right legs.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 2, 2006, 1:07pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/4 "2006-06-02T13:07:53Z")

</div>

On 02/06/2006, at 5:20 PM, Damien MERENNE wrote:

> On Thu, Jun 01, 2006 at 11:23:26PM +0200, Xavier N. wrote:
> 
> > Looked to me like a good plugin to explain those metaprogramming  
> > idioms. I blogged about it here:
> > 
> > [Advogato: Blog for fxn](http://advogato.org/person/fxn/diary.html?start=441)
> 
> Thank you very much! I did not thought it could serve as tutorial.  
> Great article.

Quick point, as Xavier’s diary doesn’t support comments.

Module#append\_features is deprecated. Module#included is the new kid  
on the block, and no need to call super!

def self.included(base)  
base.extend(ClassMethods)  
end

– tim lucas

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 2, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/5 "2006-06-02T18:27:47Z")

</div>

On 1-jun-2006, at 12:33, Damien MERENNE wrote:

> [http://blog.cosinux.org/pages/rails-history](http://blog.cosinux.org/pages/rails-history)  
> Damien, I have implemented a similar plugin a while ago, it’s called  
> Track. Maybe we could just fuse them into one?

## [http://julik.textdriven.com/svn/tools/rails\_plugins/track/](http://julik.textdriven.com/svn/tools/rails_plugins/track/)

Julian ‘Julik’ Tarkhanov  
please send all personal mail to  
me at julik.nl

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 2, 2006, 5:48pm UTC](https://www.ruby-forum.com/t/ann-history-plugin/95440/6 "2006-06-02T17:48:18Z")

</div>

On Jun 2, 2006, at 13:05, Tim L. wrote:

> Quick point, as Xavier’s diary doesn’t support comments.
> 
> Module#append\_features is deprecated. Module#included is the new  
> kid on the block, and no need to call super!
> 
> def self.included(base)  
> base.extend(ClassMethods)  
> end

Thank you!

Is there a reason to call class\_eval inside history()?

def history(options)  
logger.debug(“history: setting up history”)  
include History::InstanceMethods  
class\_eval do  
ActionController::Base.history\_container =  
History::Container.new(options)  
after\_filter :store\_location  
end  
end

Wouldn’t that code work without class\_eval? (See mock-up below, where  
croak is after\_filter, and tryme is history)

– fxn

class Base  
def self.croak  
puts “croak! in #{self}”  
end  
end

module M1  
def self.included(base)  
base.extend(M2)  
end

module M2  
def tryme  
croak  
end  
end  
end

class Base  
include M1  
end

Base.tryme # -\> croak! in Base
