focused_controller icon indicating copy to clipboard operation
focused_controller copied to clipboard

Instance variables not available in template

Open kosmodisk opened this issue 11 years ago • 2 comments

Instance variables set in call are not available in template.

module FooController
  class Bar < Action
    def call
      @foo = 'foofoo'
    end
  end
end

bar.html.erb

<%= @foo.inspect %>

Outputs 'nil'.

kosmodisk avatar Oct 22 '14 14:10 kosmodisk

Any comments/news on that?

kosmodisk avatar Dec 01 '14 09:12 kosmodisk

I believe using instance variables to share data to the view is another "wart" / design decision that this project doesn't agree with and adds another boundary.

Use expose as explained in the README ?

nixme avatar Sep 11 '16 03:09 nixme