Forum: Ruby on Rails "No rhtml, rxml, rjs or delegate template found" -- help!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
rph (Guest)
on 2007-02-07 16:46
I have some static partials that do not belong to any controller, and
don't actually have ruby code in them (which should be irrelevant
anyway).  I have to read the files in, and allow a user to click
next/prev to navigate through them.  I can read the directories fine,
get access to the files, etc., but I'm having trouble with the
application knowing about my custom folder in the "views" directory (I
think).

Here's what I'm doing on page load (which isn't working):

<% render :partial =>
"#{CONTENT_BASE}/#{@thing.folder_title}/#{make_partial(@random_file)}"
%>

Here's an explanation:

# in environment.rb
CONTENT_BASE = "#{RAILS_ROOT}/app/views/content"

# @thing.folder_title
=> the_parent_folder

# make_partial(_random.rhtml)
=> random

So if I print out this line, without rendering the partial, I get the
correct path:

# looking at the path
"./script/../config/../app/views/content/the_parent_folder/random"

But I'm getting the error ActionView error "No rhtml, rxml, rjs or
delegate template found"

Is there something I'm missing?  Can you not reference a static partial
if it doesn't belong to a controller?  How can I get my application to
understand this?  Thanks!
Bill S. (Guest)
on 2007-02-07 16:58
(Received via mailing list)
Rails assumes that the path specified for a partial is located under
app/view ... not the full-path. Therefore you just need to change your
CONTENT_BASE to be "content". Also make sure you use
<%= %> and not <% %>

-Bill
rph (Guest)
on 2007-02-07 17:56
Bill S. wrote:
> Rails assumes that the path specified for a partial is located under
> app/view ... not the full-path. Therefore you just need to change your
> CONTENT_BASE to be "content". Also make sure you use
> <%= %> and not <% %>
>
> -Bill

Thank you... that worked.
This topic is locked and can not be replied to.