how to use templates in ruby

hi all,

I have created links ie:-

/articles /news

and i looked on a site and it said creating a .rhtml file in the app/views/articles news etc but when i created news.rhtml and articles.rhtml and put it in the folder in the app/views and its still reading the

class ArticlesController < ApplicationController def index render :text => "This is the articles page" end

end

in the controller and not the .rhtml file

how is this done

If I understand correctly, the fact that you call render explicitely in the controller, will avoid the "automatic" render of the template in app/views/articles/index.html.erb

So, I suggest yoiu change as follows:

Controller: ../app/controllers/articles_controller.rb

class ArticlesController < ApplicationController      def index        @test_article = "This is a test article"      end end

Views: ../app/views/articles/index.html.erb

<p>test of an article <%=h @test_article %></p>

Then go to

htpp://localhost:3000/articles/

HTH,

Peter

Forgot to explain this. Only if you did not explicitly call 'render' or 'redirect_to' Rails will automatically call the render function on the corresponding location in the ../app/views/ directory.

Peter