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) Thank''s -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
-----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-----
On 4/20/05, David Morton <mortonda-0/IDydmJJnNeoWH0uzbU5w@public.gmane.org> wrote:> or > > sql = "SELECT articles.*, authors.name AS author_name " + > ~ "FROM articles " + > ~ "LEFT JOIN authors ON author_id = authors.id" >or (which *may* save a couple calls to malloc?) sql = "SELECT articles.*, authors.name AS author_name " \ "FROM articles " \ "LEFT JOIN authors ON author_id = authors.id" Cheers, bs.
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Pedro Valentini wrote: | 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 ) | ?? jscript = %( my string here #{@myStrVar} ) - -- 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 iD8DBQFCaTx/SIxC85HZHLMRAvXLAKCBcfRTQ0uj0pzaNMtiH+/609XvswCfUbhJ oBv8o3UiOMbFHN7KZKDL0z0=prMj -----END PGP SIGNATURE-----