Rails Render Issue

Hi, I am adding login functionality to my app which has two controllers users and photos and i am having some trouble.

In my users/index view

  <%if logged_in? %>     <%=render "photos/index"%>    <%else%>       .... Home page With login.....    <%end%>

  In my photos/index view

  <%if logged_in? %>       .... Welcome page .....

   <%else%>       <%=render "users/index"%>     <%end%>

  Routes:    map.root :controller => 'user', :action => 'surahome'

   When i login to the page, it redirects to http://www.example.com/photos and the page displays correctly.

   When i access the main url http://www.example.com

    i got this error : Missing template photos/_index.erb in view path app/views

   I am working with rails 2.3.5

Any sugestions?

Thanks in advance Senling

Hi, I am adding login functionality to my app which has two controllers users and photos and i am having some trouble.

In my users/index view

<%if logged_in? %> <%=render "photos/index"%> <%else%> .... Home page With login..... <%end%>

In my photos/index view

<%if logged_in? %> .... Welcome page .....

<%else%> <%=render "users/index"%> <%end%>

Routes: map.root :controller => 'user', :action => 'surahome'

Should that be 'users'?

When i login to the page, it redirects to http://www.example.com/photos and the page displays correctly.

When i access the main url http://www.example.com

i got this error : Missing template photos/_index.erb in view path app/views

What do you see in development.log when you do this?

Colin

Controller name user.

I have changed to user/index, still same error.

Development.log:

That is looking for sandbox/_index.erb, which you have apparently not provided

Colin

hits: redirect_to :controller => ‘photos’, :action => ‘index’