Homepage as index.rhtml, not index.html?


#1

Hi all,

I’m building my first Rails app. Please forgive my ignorance as I get
acquainted with the technology.

What I’d like to do is have a form that the scaffolding created for me
appear on my home page. It’s just one text field, a submit button, and
some error messages.

I first tried to copy the code from the new.rhtml view into the homepage
(index.html), then realized I had to change the filename to rhtml.
Doing so seemed to confuse the Routing.

I also considered putting an iframe onto the homepage, but that seems
awkward to me.

Can someone please help a rookie? Thanks!


#2

Hi ~

.rhtml files are template files and are stored in the views folder.
.rhtml files will not be processed in the public directory. What you
want to do is change the default route in your config/routes.rb file.

Something like:

map.connect “”, :controller => “your_controller_here”

Hope this helps,

Ben

On 3/28/06, Dan C. removed_email_address@domain.invalid wrote:

(index.html), then realized I had to change the filename to rhtml.
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Ben R.
http://www.benr75.com


#3

Ben,

Perfect! Thank you.

The section on config/routes.rb in Agile Web D. on Rails (pg.
291) was also helpful.

Dan