Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling Helper Method from partial view

In my bar.html I render a partial view and in it I want to call the method foo(var1, var2) and get an array back. On my local system everything works finde but on my production system the following error occurs.

undefined local variable or method `foo' for #<#<Class:0x70c6410>:0x706f480>)

Can someone explain this to me?

The Class #<#:0x706f480> changes with every call so it seems that the view does not try to search the function in my helper.

EDIT:

The application has the following structure (example)

app/helpers/bar_helper
app/views/bar/bar.html.erb
app/views/bar/partials/bar_partial.html.erb

and in bar_partial.html.erb I call foo(var1, var2) in my bar_helper like this

<% data = foo(var1, var2) %>
like image 962
Sebastian Müller Avatar asked Jan 28 '26 00:01

Sebastian Müller


1 Answers

The problem was, that the class existed a second time somewhere in the folder structure so that ruby found the first file and used that one instead of the right one.

like image 102
Sebastian Müller Avatar answered Jan 30 '26 21:01

Sebastian Müller