I'm trying to access a helper variable from a haml view in my project. I have the helper defined in rails-root/app/helpers/table_field_helper.rb
:
module TableFieldHelper
def table_display_fields
MORE_COMPLICATED_TABLE_DISPLAY_FIELDS #some array defined elsewhere in the file
end
...
end
And trying to iterate over table_display_fields
in index.html.haml:
...
%tr
%th
- table_display_fields.each do |field|
%th= field
...
I'm getting an error: undefined local variable or method 'table_display_fields'
What's causing this error? Why am I unable to access the definition in TableFieldHelper? I am new to Ruby/Rails, but I was under the assumption that all helpers are implicitly included in view/layout files, and nothing I've read would suggest I have to do anything extra to make them work together. Thanks!