OK, here's what I have in app/views/molds/show.html.erb:

<tr><td><%= @mold.body.gsub( "\n", "<br />" ) %></td></tr>

The controller finds @patient, and @patient.id = 2

If @mold.body = "The patients id is <%= @patient.id %>"

Then the view displays

The patients id is <%= @patient.id %>

rather than

The patients id is 2

Same goes for replacing <%= with #{ and %> with }

Many TIA,
Craig

On Feb 27, 10:21 am, Craig White <craigwh...@azapple.com> wrote:
> On Sat, 2010-02-27 at 07:43 -0800, Dudebot wrote:
> > Thanks, Craig--I think my example was too terse.  What I'm trying to
> > do is to pass a block of text to a view which may contain multiple
> > references to external models, and I'd like to interpolate those
> > references.
>
> > So, for example, if @thing.body = " This is the id of foo: <%= @foo.id
> > %> and this is its body: <%= @foo.body %> "
>
> > If @foo.id = 2 and @foo.body = "Norman", I'd like in the view
> > whatever.html.erb to have
>
> > <%= @thing.body %>
>
> > display
>
> > This is the id of foo: 2 and this is its body: Norman
>
> > Is there a way to do that?  I also tried #{ ... } and am still getting
> > the literal rather than the interpolation.
>
> ----
> try actual code examples
>
> Craig
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

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