# UserEngine and hiding controllers

**URL:** <https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645>\
**Category:** Rails\
**Created:** [May 16, 2006, 2:49pm UTC](https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645 "2006-05-16T14:49:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![riko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/919ad9/32.png) [@riko](https://www.ruby-forum.com/u/riko)\
**Post date:** [May 16, 2006, 2:49pm UTC](https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645/1 "2006-05-16T14:49:03Z")

</div>

I’m using LoginEngine + UserEngine for web application.

1. I have some controllers under and admin subdirectory  
(Admin::PostController etc). The auto-fill permission in UserEngine  
does not work correctly with those controllers.

Right at the moment this is not a problem, since I kind like having the  
Admin section separated and available only for god users. However, I  
could use Something::Controller somewhere else, and I would like to know  
how it deals with these.

1. I need to redefine the views included in the engines. Is it  
sufficient to create an /app/views/user directory and put the new rhtml  
files there? Has it got any drawbacks?

2. How can I “hide” a controller without accessing its source code? That  
is to say I do not want people to mess with the RoleController and  
PermissionController. I kind of need to make them not accessible.

Their functionality will be available from Admin::RoleController \<  
RoleController, or something like this.

I do not want to edit their code, since when my hosting upgrades to  
Rails 1.1 I may want to upgrade the engines too, and since it is  
something I know will happen, I would like not to have to mess with svn  
diffs if I can avoid it 🙂

Tanks in advance

–  
blog: [http://www.akropolix.net/rik0/blogs](http://www.akropolix.net/rik0/blogs) |  
site: [http://www.akropolix.net/rik0/](http://www.akropolix.net/rik0/) |  
forum: [http://www.akropolix.net/forum/](http://www.akropolix.net/forum/) |

---

<div class="post-metadata">

**Author:** ![riko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/919ad9/32.png) [@riko](https://www.ruby-forum.com/u/riko)\
**Post date:** [May 17, 2006, 8:53pm UTC](https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645/2 "2006-05-17T20:53:37Z")

</div>

Riko [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> 1. I need to redefine the views included in the engines. Is it  
> sufficient to create an /app/views/user directory and put the new  
> rhtml files there? Has it got any drawbacks?

Thats the way to do it. You can also override some of the controller  
actions.

> something I know will happen, I would like not to have to mess with  
> svn diffs if I can avoid it 🙂

With the `authenticate’(check the docs to confirm name) filter the  
actions can  
be hidden from the guest, and the user roles.

Besides you can also redefine the actions (the old definitions get  
overridden).

I will suggest reading the engines wiki, and the readmes, also engines  
mailing  
list will be a better place to ask such questions.

HTH.

–  
Surendra S.  
[http://ssinghi.kreeti.com](http://ssinghi.kreeti.com), [http://www.kreeti.com](http://www.kreeti.com)  
Read my blog at: [http://cuttingtheredtape.blogspot.com/](http://cuttingtheredtape.blogspot.com/)  
,----  
| “War is Peace! Freedom is Slavery! Ignorance is Strength!”  
| – Orwell, 1984, 1948  
`----

---

<div class="post-metadata">

**Author:** ![riko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/919ad9/32.png) [@riko](https://www.ruby-forum.com/u/riko)\
**Post date:** [May 19, 2006, 6:00pm UTC](https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645/3 "2006-05-19T18:00:28Z")

</div>

Surendra S. wrote:

> Thats the way to do it. You can also override some of the controller actions.

Ok. Thank you very much.

> With the `authenticate’(check the docs to confirm name) filter the actions can  
> be hidden from the guest, and the user roles.

I know the guest can’t call it. I would have liked something like a  
“private” controller. But I suppose it’s the wrong way to do it.

> Besides you can also redefine the actions (the old definitions get overridden).

Yes, but I need them in the children. I think this gets messy for what  
I’ve to do.

> I will suggest reading the engines wiki, and the readmes, also engines mailing  
> list will be a better place to ask such questions.

Didn’t even know it existed. Thank you very much.

–  
blog: [http://www.akropolix.net/rik0/blogs](http://www.akropolix.net/rik0/blogs) |  
site: [http://www.akropolix.net/rik0/](http://www.akropolix.net/rik0/) |  
forum: [http://www.akropolix.net/forum/](http://www.akropolix.net/forum/) |

---

<div class="post-metadata">

**Author:** ![riko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/919ad9/32.png) [@riko](https://www.ruby-forum.com/u/riko)\
**Post date:** [May 19, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/userengine-and-hiding-controllers/60645/4 "2006-05-19T18:10:17Z")

</div>

Every time I use the follow\_redirect() function within a controller  
test, I get the following error:

“TypeError: can’t convert Symbol into String”

Looking at the source for this method I see:

377: def follow\_redirect  
378: if @response.redirected\_to[:controller]  
379: raise “Can’t follow redirects outside of current controller  
(#{@response.redirected\_to[:controller]})”  
380: end  
381:  
382: get(@response.redirected\_to.delete(:action),  
@response.redirected\_to.stringify\_keys)  
383: end

I’m not really familiar with the internals of rails, but the following  
seems wrong:

“get(@response.redirected\_to.delete(:action)”

“@response.redirected\_to()” will return a String object…it appears  
that returning  
a Hash was the intended behavior thus the appending of delete(:action)  
and stringify\_keys().  
Is this bug or am I missing something?

Kind Regards,

-Steven H.
