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

2010/1/22 senling [email protected]:

<%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:


Processing UserController#surahome (for 192.168.1.5 at 2010-01-23
00:09:08) [GET]
Rendering template within layouts/standard
Rendering user/surahome

ActionView::TemplateError (Missing template sandbox/_index.erb in view
path app/views) on line #4 of app/views/user/surahome.html.erb:
1: Sura Systems
2:
3: <%if logged_in? %>
4: <%=render “sandbox/index”%>
5: <%else%>
6:
7:

app/views/user/surahome.html.erb:4
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
fcgi (0.8.7) lib/fcgi.rb:117:in `session'
fcgi (0.8.7) lib/fcgi.rb:104:in `each_request'
fcgi (0.8.7) lib/fcgi.rb:36:in `each'
dispatch.fcgi:24

Rendered rescues/_trace (143.9ms)
Rendered rescues/_request_and_response (0.5ms)
Rendering rescues/layout (internal_server_error)


Controller name user.

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

Development.log:


Processing UserController#index (for 192.168.1.5 at 2010-01-23
00:09:08) [GET]
Rendering template within layouts/standard
Rendering user/index

ActionView::TemplateError (Missing template sandbox/_index.erb in view
path app/views) on line #4 of app/views/user/index.html.erb:
1: Sura Systems
2:
3: <%if logged_in? %>
4: <%=render “sandbox/index”%>
5: <%else%>
6:
7:

app/views/user/index.html.erb:4
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
fcgi (0.8.7) lib/fcgi.rb:117:in `session'
fcgi (0.8.7) lib/fcgi.rb:104:in `each_request'
fcgi (0.8.7) lib/fcgi.rb:36:in `each'
dispatch.fcgi:24

Rendered rescues/_trace (143.9ms)
Rendered rescues/_request_and_response (0.5ms)
Rendering rescues/layout (internal_server_error)


On 23 January 2010 07:20, senling [email protected] wrote:

Rendering user/index

ActionView::TemplateError (Missing template sandbox/_index.erb in view
path app/views) on line #4 of app/views/user/index.html.erb:
1: Sura Systems
2:
3: <%if logged_in? %>
4: <%=render “sandbox/index”%>

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

Colin

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

2010/1/23 Colin L. [email protected]

Rendering template within layouts/standard
provided
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


tommy xiao
E-mail: xiaods(AT)gmail.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs