# How can I extend ActionController

**URL:** <https://www.ruby-forum.com/t/how-can-i-extend-actioncontroller/114751>\
**Category:** Rails\
**Created:** [September 17, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/how-can-i-extend-actioncontroller/114751 "2007-09-17T13:25:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSS\_SSSSSSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@SSSS\_SSSSSSSSSSSS\_S](https://www.ruby-forum.com/u/SSSS_SSSSSSSSSSSS_S)\
**Post date:** [September 17, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/how-can-i-extend-actioncontroller/114751/1 "2007-09-17T13:25:09Z")

</div>

I’m coding with a Rails plugin, which need to extend ActionController  
so that action callback can be made when a view-generated hyper-link  
is clicked.

But when i wrote some code like these:

module MyController  
def callback\_action()  
@origin\_page=’’  
p params  
redirect\_to :action=\>:index  
end  
end

and wrote these in init.rb:

```
  ActionController::Base.send(:include, MyController)

```

Rails seemed not knowing this callback\_action method ( ’ unknown  
action callback\_action in xxx’)

why? So , what should I do to extend the fucking  
ActionController::Base ?

help me!

---

<div class="post-metadata">

**Author:** ![SSSS\_SSSSSSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@SSSS\_SSSSSSSSSSSS\_S](https://www.ruby-forum.com/u/SSSS_SSSSSSSSSSSS_S)\
**Post date:** [October 15, 2007, 2:14am UTC](https://www.ruby-forum.com/t/how-can-i-extend-actioncontroller/114751/2 "2007-10-15T02:14:36Z")

</div>

On Sun, 2007-09-16 at 01:31 -0700, å¤§å¸ˆå‚… wrote:

> ```
> redirect_to :action=>:index
> 
> ```
> 
> why? So , what should I do to extend the fucking  
> ActionController::Base ?
> 
> help me!
> 
> >

do you have a real MyController class.  
not a module

if you have both MyController Module And MyController Class.

may not work correct.
