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