Re: Error in tutorial or sintax changed?

David Morton
2005-04-20T21:09:52Z

-----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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCZsUgSIxC85HZHLMRAkKCAKCY0hj4JFHuXv56cGrEwg8XU+CUrwCfZ6r+
ByFmSgUrKV1rIi14x1plc28=9ZtM
-----END PGP SIGNATURE-----