11175
(-- --)
1
Hello there,
I have a code like.
...
items = entries.map { |entry| content_tag("li", mask, :id =>
"#{entry.id}")}
...
I want to evaluate the ruby code in the string mask on the fly... it
content is:
"#{entry.name} - #{entry.state.name}/#{entry.country.name}"
I have tried "eval mask" but with no success.
thanks,
David Sousa
Hello there,
I have a code like.
...
items = entries.map { |entry| content_tag("li", mask, :id =>
"#{entry.id}")}
...
I want to evaluate the ruby code in the string mask on the fly... it
content is:
"#{entry.name} - #{entry.state.name}/#{entry.country.name}"
I have tried "eval mask" but with no success.
Well eval is the method that evaluates code for you. In what way did
it not work ?
Fred
11175
(-- --)
3
When I try to do:
items = entries.map { |entry| content_tag("li", "#{eval(mask)}", :id =>
"#{entry.id}")}
or
items = entries.map { |entry| content_tag("li", eval(mask), :id =>
"#{entry.id}")}
I get nil as result.
David Sousa