On 28 August 2014 14:14, Dave Castellano <[email protected]> wrote:
> Hi,
>
> The hyperlink below is being evaluated to "questions/www.somewhere.com":
>
> q = eval(question) # Converts (evaluates) the question string from the
> database back into code.
>
> question ="
> ... from a light source is equal to the <a
> href='www.somewhere.com'>index of refraction</a> (n) divided by the
> distance (in meters) of the light rays..."
>
>
> Can anyone point me in the right direction as to why "questions" is
> being prepended to the route and how to avoid that from happening.

What is the content of q after assigning the eval to it?  As you have
described it I would have expected that to generate a runtime error:
1.8.7-p374 :003 > question ="... from a light source is equal to the
<a> href='www.somewhere.com'>index of refraction</a> (n) divided by
the distance (in meters) of the light rays..."
 => "... from a light source is equal to the <a>
href='www.somewhere.com'>index of refraction</a> (n) divided by the
distance (in meters) of the light rays..."
1.8.7-p374 :004 > eval(question)
SyntaxError: (eval):1:in `irb_binding': compile error
(eval):1: syntax error, unexpected tDOT3
... from a light source is equal ...
   ^

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvAhvux7h3fGQ-Q9B8h6b9rbqFCWXfVGu0AedU5OVcmfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to