-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In ERB, `<%` denotes code, the 'result' of which doesn't get inserted,
and `<%=` denotes code, the 'result' of which does get inserted. Thus,
I expect you're finding that the `picture.title` gets inserted, but
the `n` doesn't. Try changing the line to something like:
<span id= "<%= n %>" ><%= picture.title %></span>
Peace,
tiredpixel
On 19/10/2013 22:15, Dave Castellano wrote:
> Hi,
>
> I need to use a variable set in erb to give an element an ID...
>
> For example:
>
> In view...
>
> <% n = 1 %>
>
> then
>
> <span id= "<% n %>" ><%= picture.title %></span>
>
>
> ...can't figure out how to set the ID of the span element above.
>
> Any help would be appreciated
>
> Dave
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: GPGTools -
http://gpgtools.org
Comment: Using GnuPG with Thunderbird -
http://www.enigmail.net/
iQEcBAEBAgAGBQJSYv/gAAoJEOFolTkanF7V+tgIAIZnBNq7YSVviwSsmG0rG0Ty
d1uCRHJ7zmkoI3a6wMe8jIFGcrJHZKLCnhuP61PN1J8JKbOfl3TR544jy0YDV+N0
wUz2+wOw8JEF/oqBBVOb2eiwB4A8HsshkTb2P9n+yLkXDVp+OdhJzqDX/yROJvUp
GdQw8Ihnoje88F9UVVRzDjsaxF7MO25fhGaC2od9Q8a6eun6fOGHTApncyTim8Sd
OeSW7Ez9Ucbr1bUK5AzVdTZwDcdrjfOpdaGxChS5WNpMQAZAQt2buYw9g4z+zCaq
8jsANN71pGCqZDlW2JV8Ary143WKhN6eSm0nNxOISs33pN81FdLCmlFJ2EPfbu0=
=YOpg
-----END PGP SIGNATURE-----