Help with rendering custom partials

I have to navigate through a list of content/html files in a directory,
displaying the content in a div. But I can’t seem to get the customer
partials to render within the div. Here’s what I have:

---- DIRECTORY ----

Folder_One/Sub_Folder/_this_is_partial_one.rhtml

Folder_Two/Sub_Folder/_this_is_partial_two.rhtml

Now, I have the folder names stored in the DB, and all that is left is
to pull out the partial and update the div via ajax as I navigate (using
next/prev) through the directory. But I can’t even get the page to load
the first partial, without even touching the navigation, etc. Here’s
what I’m doing:

initial load of the view

<%=render :partial => "#{@first_folder}/#{@second_folder}/#{@gsub_partial}"%>

That will return the following:
“Folder_One/Sub_Folder/this_is_partial_one”

However, I’m getting ‘@_test_file_1.rhtml’ is not allowed as an instance
variable name’

And I’ve tried keeping these external folders/files in the public
directory, as well as the lib directory. Any thoughts on why I can’t
render a custome partial?

On Feb 6, 12:37 pm, rph [email protected] wrote:

And I’ve tried keeping these external folders/files in the public
directory, as well as the lib directory. Any thoughts on why I can’t
render a custome partial?

If you want to render a partial that is not under app/views, you need
to use add a view path:
http://weblog.rubyonrails.org/2007/2/4/new-feature-for-rails-2-0-multiple-controller-view-paths

Dan M.

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