string widout '' or " =%(str) and var?

Pedro Valentini
2005-04-22T17:45:55Z

Hi,

I enjoyed
jscript = %( my string here )
but how I insert a variable in the middle of the string?
like:
jscript = %( my string here @myStrVar )
??

Thank you

--

Pedro C. Valentini
pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org
+55 (21) 8708-8035




David Morton escreveu:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Pedro Valentini wrote:
> |
> | Hi,
> |
> | In this tutorial
> | http://wiki.rubyonrails.com/rails/show/HowtoUseJoinsWithFindAll
> | it sad:
> |
> | sql =<<SQL
> | SELECT articles.*, authors.name AS author_name
> | FROM articles
> | LEFT JOIN authors ON author_id = authors.id
> | SQL
> |
> | and this return
> | *app/controllers/media_controller.rb:366: can''t find string
"SQL"
> | anywhere before EOF*
> |
> | what is wrong? the tutorial or ruby changed?
> | please, how I insert a text in a variable? (widout " or ''
to delimite
> | the string)
>
> If I remember correctly, make sure there are no trailing spaces after
> SQL.
>
>
> Or, you could do:
>
> sql = %(SELECT articles.*, authors.name AS author_name
> FROM articles
> LEFT JOIN authors ON author_id = authors.id)
>
> In this case, I don''t see what would be wrong with quotes, either.
>
> sql = "SELECT articles.*, authors.name AS author_name
> FROM articles
> LEFT JOIN authors ON author_id = authors.id"
>
> or
>
> sql = "SELECT articles.*, authors.name AS author_name " +
> ~      "FROM articles " +
> ~      "LEFT JOIN authors ON author_id = authors.id"
>
>
>
> - --
> David Morton
> Maia Mailguard server side anti-spam/anti-virus solution:
> http://www.maiamailguard.com


--

Pedro C. Valentini
pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org
+55 (21) 8708-8035