Thanks for your response.

I'm basically building static content within an existing rails
application.

I can just as easily do this with straight HTML, but since this is a
static site for our online documentation. I'm using ERb because the
individual help documents may link to each other, or link to other
parts of the rails application.  I'd prefer to use the link_to helper
methods that tie into the routes, so that if a route changes, I'm not
having to hunt down these changes in my static content.

Our help text is written into the ERb files, and Ruby is used for some
of the basic helper methods (link_to, maybe some of the other more
common ones but nothing too exotic).  We'd rather not put the help
text into the database, since it's a lot easier to maintain by editing
the help files while we're editing the application code.

We have direct control over the help text, so arbitrary code execution
is not a concern.

My show.html.erb action looks something like this:

<div id="help">
  <h1><%= h @page.description%></h1>
  <%= render @page.file %>
</div>
<div class="clear"></div>

@page.file returns a string representing the partial to be rendered,
and we have about 15-25 ERb partials that represent our help text.

Thanks--


On Jan 11, 9:44 pm, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> jeff_wigal wrote:
> > We're putting together a searchable online help site in Rails, and I'm
> > using FastRI to full-text index some existing Rails view pages to do
> > it.
>
> > I don't want to use Sphinx or some other solution, just because it's
> > way overkill for the 15-20 .html.erb partials I am looking to index.
>
> > So... I need to violate MVC (flog me now)... trying to write a Ruby
> > class that renders each of these pages as a string, and feeds the
> > rendered text as a string into FastRI for indexing.
>
> [...]
>
> If you need to do this, then you probably have a design problem which
> you should correct.  It seems to me that you'd only be using ERb for
> your help text for one of two reasons:
>
> 1. The help text is written right in the ERb file, and Ruby is only used
> for things like navbars which aren't part of the help text itself.
>
> 2. The help text is not written in the ERb file, but rather comes from a
> database or something.
>
> In neither case do you need to render the ERb to index the information.
> For case 1, just index the literal ERb (perhaps with all <%...%> removed
> for security).  For case 2, use a database query.
>
> If neither of these is your use case, please explain further.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://www.ruby-forum.com/.
-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to