Strange helper error

Hey everyone,

I have a controller called CMSController and then a helper called
cms_helper.rb. When trying to access my application I get the following:

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:249:in
`load_missing_constant’

Expected C:/DEVELOPMENT/satechevents/app/helpers/cms_helper.rb to define
CmsHelper

But the file cms_helper.rb is just an empty helper created when I
created the controller using script/generate

Any ideas?

Regards,
Schalk

Hi,

Your empty cms_helper.rb helper should contains

module CmsHelper
end

Is it the case?

Jej

Hi there,

Yip, that is exactly what it contains. Should every controller have an
associated model?

Thanks,
Schalk

Schalk N. wrote:

Expected C:/DEVELOPMENT/satechevents/app/helpers/cms_helper.rb to define
CmsHelper

In general, whenever that happens, spot-check the file with

ruby app/helpers/cms_helper.rb
script/runner app/helpers/cms_helper.rb

Sometimes when the Magic Loader finds a syntax error inside a file, it
throws
the error away, then complains the file did not define its target class.

Next, calling a controller CMSController gives me a bad feeling. Maybe
Rails
parses it correctly, but we always go with like CmsController.

Should every controller have an associated model?

No; a controller is like a telephone operator switchboard. It just plugs
models
and views together so they can communicate.

How are your unit tests doing?


Phlip

Hi there Phlip,

Changing to Cms as apposed to CMS did the trick, thanks!

Regards,
Schalk