I have this (simplified) helper function in Rails:
include Constants
def link_to_neighbour(direction, path)
symbol = direction.upcase.constantize
link_to symbol, path
end
In lib/constants I defined these constants:
PREVIOUS = "<<"
NEXT = ">>"
Yet when I use something like this in one of my views...
<%= link_to_neighbour('next', @user, user_path(@user)) %>
... I constantly get this error:
NameError
uninitialized constant NEXT
What am I missing here?
Thanks for any help.
Constants::PREVIOUSandConstants::NEXT.Constants::prefix there.