views:

292

answers:

1

I am currently delevoping a community using Community Engine, but I need to add some models.

The problem is that I need the helpers methods that are used by CE, but when I try to access the new sections of the site, I get a undefined method (like below)

undefined method `logged_in?' for #<ActionView::Base:0x1048f3748>

The logged_in? method is at vendor/plugins/community_engine/lib/authenticated_system.rb

These method is defined as a helper method like this:

# this is at vendor/plugins/community_engine/lib/authenticated_system.rb
def self.included(base)
  base.send :helper_method, :current_user, :current_user_session, :logged_in?, :admin?, :moderator?
end

How can I make my rails application load all the helpers and the methods declared in lib of my plugins?

A: 

Most sites that I've worked with physically copy the authenticated_system.rb file into #{RAILS_ROOT}/lib and check it in.

That way you can override the methods if you need to.

Taryn East
And what about the helpers? I can include the module, but still having trouble with the helpers =S
Hock
The library I mention above is the one that includes all of the helper methods in it. If you copy it into the lib directory, then use `include AuthenticatedSystem` in your controller - it will find the helper methods.
Taryn East
I've copied the module in the RAILS_ROOT/lib directory but the helpers (vendor/plugins/community_engine/app/helpers/) are still giving me problems =S I can't use those methods in my custom models =S
Hock