Re: How can i call an instance variable?

Mark Weston
Mon, 25 Jul 2011 02:20:41 -0000

On 25 July 2011 02:38, Ivan Santana
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:

> Hi, Im reading an old tutorial about instance variables.
>
> However i wasnt able to call de instance variable from the CONTROLLER to
> the VIEW.
>
> The code is:
> ----------------------------------
> VIEW :
>
>
>
> title
>
>
> line 1
> <%= @text %>
>
>
>
>
> --------------------------------
> CONTROLLER:
>
> class MoviesController < ApplicationController
>  def movies
>    @text = "movietitle"
>  end
> end
>
> ---------------------------------
>
> When i load the page, it only shows the line 1 paragraph.
>
> How can i call the instance variable @TEST?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
You *can* see Controller instance variables in views.  The question is, is
that method #movies in your controller actually being called?