Forum: Ruby on Rails Strange helper error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
44391f94143d129bdfdcd8b52aa51674?d=identicon&s=25 Schalk Neethling (Guest)
on 2008-12-06 16:35
(Received via mailing list)
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
Ad8b580d8004335c95d2d15518168ce3?d=identicon&s=25 Jej (Guest)
on 2008-12-06 16:37
(Received via mailing list)
Hi,

Your empty cms_helper.rb helper should contains

module CmsHelper
end

Is it the case?

Jej
44391f94143d129bdfdcd8b52aa51674?d=identicon&s=25 Schalk Neethling (Guest)
on 2008-12-06 16:44
(Received via mailing list)
Hi there,

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

Thanks,
Schalk
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2008-12-06 17:15
(Received via mailing list)
Schalk Neethling 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
44391f94143d129bdfdcd8b52aa51674?d=identicon&s=25 Schalk Neethling (Guest)
on 2008-12-06 20:39
(Received via mailing list)
Hi there Phlip,

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

Regards,
Schalk
This topic is locked and can not be replied to.