Ruby on Rails Saturday, January 3, 2015

You need to use helper_method :test_method? in your Application helper file. I believe this will give you access to the method inside the view
http://apidock.com/rails/ActionController/Helpers/ClassMethods/helper_method

On Friday, January 2, 2015 11:04:16 AM UTC-5, Alain Goldman wrote:

When I to call a method in a partial I get a 'undefined local method for class' error.

in my view, home.haml

    = render "layouts/side"

in my partial /layouts/_side.haml

    %div        - test_method?          Is true.

In the controller that serves home.haml I put

    def test_method?        return true      end

I even tried putting the method in the application helper file, no cigar. Any ideas?

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0a8be21d-8d62-42c5-8daa-515bd39d9964%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment