I have a rails application that is up and running on Ubuntu virtual machine and on several different installations.
I have a new computer and after installing Ruby and Rails (using rvm) I can run the application but when accessing views the helper functions are not found. The helper :all line is in the ApplicationController.
I am pretty sure this is a problem with my environment and not the app. Is there a missing gem that would cause this problem?
Can you recommend any steps that I could take to debug this issue?
MacBook-Air:cyberdojo mike$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0]
MacBook-Air:cyberdojo mike$ rails -v
Rails 2.3.11
The actual error I get is this:
NoMethodError in Dojo#create
Showing app/views/dojo/create.html.erb where line #62 raised:
undefined method `ellided_name' for #<ActionView::Base:0x101fabf70>
Extracted source (around line #62):
59: value="<%=@dojo.name-%>" />
60:
61: <h1 title="<%= @dojo.name-%>">
62: <%= ellided_name(@dojo.name, 40) %>
63: </h1>
64:
65: <table align="center">
The source code can be seen here: https://github.com/meekrosoft/cyberdojo
Your
vendordirectory has a bunch of symlinks to/usr/share/rails. That’s probably why it’s working on some servers (because on those servers those symlinks are working) and not on others.Your helpers aren’t working because they should be within modules, so
app/helpers/ellided_name.rbshould have:I’m guessing that some older version of Rails (the one you have in
/usr/share/railson your servers) allowed the non-module syntax.Warning based on the 2.1.0 in your
config/environments.rbthis app has been around for a long time, and if the/usr/share/railsversion is anywhere close to 2.1 then this will be the first of many problems you’ll have trying to run this app as-is in 2.3.Update
The OP discovered a gap in my recommendation, I’m just adding it here for anyone who finds this in google – he also needed to add the
_helpersuffix to the filenames, so as well as adding themodulewrappers within the files he had to changeapp/helpers/ellided_name.rbtoapp/helpers/ellided_name_helper.rband (he didn’t say, but I’m sure) the module name needed to reflect this, soEllidedNameHelperinstead of justEllidedName