# Is this a bug or expected behavior?

**URL:** <https://www.ruby-forum.com/t/is-this-a-bug-or-expected-behavior/110770>\
**Category:** Rails\
**Created:** [July 30, 2007, 6:54pm UTC](https://www.ruby-forum.com/t/is-this-a-bug-or-expected-behavior/110770 "2007-07-30T18:54:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluengreen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bluengreen](https://www.ruby-forum.com/u/bluengreen)\
**Post date:** [July 30, 2007, 6:54pm UTC](https://www.ruby-forum.com/t/is-this-a-bug-or-expected-behavior/110770/1 "2007-07-30T18:54:15Z")

</div>

Just wondering if anybody has had this “problem” or feature with Rails  
apps. I noticed that if I drop a .rhtml file in the views folder for a  
controller I can render that template by action name even though I  
have not defined the action in my controller.

For example. I created a products controller. I added a index method  
in the controller. There is a coordinating views directory - app/views/  
products. This directory has a index.rhtml file. I added a edit.rhtml  
and \_form.rhtml that was created using a generated scaffold.

My controller is bare bones:

class ProductsController \< ApplicationController

def index  
@products = Product.find\_products\_for\_sale  
@tree = Category.find(:all, :include =\> [:children])  
end

def show  
@product = Product.find(params[:id])  
end

end

Ok. So if I go to localhost:3003/products/edit/. I get the edit page  
and the form. The form will not process but it still displays. To me,  
this seems like incorrect behavior since I have not defined the action  
in my controller. It also seems to go against the idea of my  
controller - controlling. I dunno. Anybody else experience this? Is  
this suppose to be like this?

Thansk,  
Phill Novess

---

<div class="post-metadata">

**Author:** ![bluengreen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bluengreen](https://www.ruby-forum.com/u/bluengreen)\
**Post date:** [July 30, 2007, 9:33pm UTC](https://www.ruby-forum.com/t/is-this-a-bug-or-expected-behavior/110770/2 "2007-07-30T21:33:37Z")

</div>

by default, the route.rb will take any :controller/:action call you  
send to it and then check if it can be processed. If you delete that  
route and only use named routes (as you should in preparation for RoR  
2.0, only predefined routes/actions will be accessible.
