From: Josh Cheek Date: 2013-02-17T08:09:18+09:00 Subject: Re: Can not find variable in the current scope! --f46d040890c1984ca104d5df94e4 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Feb 16, 2013 at 6:53 AM, David Unric wrote: > Hello, > > when trying to add tracing output to an erb template I hit the following > issue when trying to find where variable ex_title comes from. > > Tried to list all possible variables in the current scope, but there > simply does not exists: > <%= instance_variables.grep(/ex_title/) %> # renders an empty array > <%= global_variables..grep(/ex_title/) %> # renders an empty array > <%= local_variables..grep(/ex_title/) %> # renders an empty array > > <%= instance_variables.sort %> # renders array with many elements > <%= global_variables.sort %> # renders array with many elements > <%= local_variables.sort %> # renders array with many elements > > Whereas ex_title variable provably does exists: > <%= ex_title %> # renders value "Categories - Online > store" > <%= ex_title.class %> # renders "String" > <%= ex_title.object_id %> # renders "15825900" > > Where else can be found if not in global, local or instance variables ? > > -- > Posted via http://www.ruby-forum.com/. > > You have two dots, which would be a range. If that doesn't solve it, but more probably, ex_title is a method <%= methods.grep(/ex_title/) %> -Josh --f46d040890c1984ca104d5df94e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, Feb 16, 2013 at 6:53 AM, David Unric <lists@ruby-forum.com= > wrote:
Hello,

when trying to add tracing output to an erb template I hit the following issue when trying to find where variable ex_title comes from.

Tried to list all possible variables in the current scope, but there
simply does not exists:
<%=3D instance_variables.grep(/ex_title/) %> =A0 # renders an empty a= rray
<%=3D global_variables..grep(/ex_title/) %> =A0 =A0# renders an empty= array
<%=3D local_variables..grep(/ex_title/) %> =A0 =A0 # renders an empty= array

<%=3D instance_variables.sort %> =A0 # renders array with many elemen= ts
<%=3D global_variables.sort %> =A0 =A0 # renders array with many elem= ents
<%=3D local_variables.sort %> =A0 =A0 =A0# renders array with many el= ements

Whereas ex_title variable provably does exists:
<%=3D ex_title %> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# renders value = "Categories - Online
store"
<%=3D ex_title.class %> =A0 =A0 =A0 =A0 =A0 =A0# renders "String= "
<%=3D ex_title.object_id %> =A0 =A0 =A0 =A0# renders "15825900&q= uot;

Where else can be found if not in global, local or instance variables ?

--
Posted via http://= www.ruby-forum.com/.


You have two dots, which would be= a range. If that doesn't solve it, but more probably, ex_title is a me= thod

<%=3D=A0methods.grep(/ex_title/) %>

-Josh
--f46d040890c1984ca104d5df94e4--