accessing one controller from another

I have a posts controller and a pages controller for 'static' pages ie
my homepage
I want to have the latest post shown on the homepage.... accessing the
posts controller from within the pages controller

Is there a way I can do this?

thanks

The posts controller doesn't come into the picture; just get the post
info in your pages controller.

def homepage
   @post = Post.latest # assuming a named scope
   render ...

HTH,

what is render for?

in …/layout/application.rhtml

there will be home page
<%= render :partial => ‘layouts/homepage’ %>
in home page call your all pages …which u want to show

<%= render :partial => ‘layouts/posts’ %>

<%= render :partial => ‘layouts/news’ %>
…etc

-Shyam

I just put that there to represent standard controller stuff -- whatever
else you have in that controller method.

If you mean `what does render do?`, it's time to open the API docs :slight_smile:

that's what I assumed but wasn't sure if you meant render a partial...

got it working now
thanks!