I am getting a NoMethodError, with the following decription:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
The error is raised on function call line of the ‘.html.erb’ file.
The function is present in the relevant ‘helper.rb’ file and contains
def splitBonusUnit(data) @returnValue = @data.split(/ /) return @returnValue end
The ‘data’ value passed into the function is confirmed to be “2 3”; when
the code @data.split(/ /) is entered into the Ruby shell it works and
expected and [“2”, “3”] is returned.
Why is this not working correctly when put within the Ruby on Rails web
pages? If I take the ‘split’ command out of the helper function, it also
My understanding of Ruby and Ruby on Rails is limited, as is likely
obvious, so although I have found a way around it, I would appreciate a
pointer to why it does what it does.