Did you follow the README, particularly the lines talking about adding
certain include lines to ApplicationHelper?

- james

On 7/28/06, gwen campbell <[EMAIL PROTECTED]> wrote:
> This is likely a painfully newbie-ish question, so please bare with me :)
>
> I'm muddling through my first rails application, and decided to use the
> Login Engine to handle user authentication. Now, according to the
> README, I should be able to "use current_user method provided by
> UserHelper", like so:
>
>           Welcome <%= current_user.name %>
>
> I've put that line in my application.rhtml, and return the following error:
>
>     undefined local variable or method `current_user' for
> #<#<Class:0xb7875280>:0xb7875258>
>
> which seems to suggest I haven't done something correctly.
>
> Now, I can find where current_user is set in
> vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb
>
> I'm still trying to work out what goes where in rails, but I figured in
> order for the method to be available globally, I needed to move that
> definition into app/controllers/application.rb. Still received the same
> error, however.
>
> I then tried adding the definition for current_user to
> app/helpers/application_helper.rb, and that sort of did the trick.
> "Welcome <%= current_user.name %>" now translates properly in my layout.
>
> My real goal, however, is to get usermonitor to work
> (http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by/versions/7),
> and current_user still does not appear to be accessible by this module.
> When I attempt to edit an object in one of my models, I get the error:
>
>     undefined method `current_user' for User:Class
>
> So I gather app/helpers/application_helper.rb is likewise not the
> correct place for this.
>
> I then try putting it in config/environment.rb (which seems even less
> likely, though at this point I do have to concede 'what do I know?'),
> which also appears to work as far as my application.rhtml is concerned.
> But when I try to edit an object, I now get:
>
>     private method `current_user' called for User:Class
>
> This feels a bit like progress, but I'm stumped regarding how to make
> this method public (and whether or not that's really what I want to do).
> If I understand things correctly, methods *are* public by default, and
> only become private when "private" is placed before their definition?
> Which is fine, except that there is no instance of "private" in my
> config/environment.rb
>
> At this point, I'm stumbling blind, and don't know if I'm even remotely
> headed in the right direction. If somebody could give me a nudge in that
> right direction, I would be so very grateful!
>
> Thanks in advance,
>
> Gwen
> _______________________________________________
> engine-users mailing list
> engine-users@lists.rails-engines.org
> http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
>


-- 
* J *
  ~
_______________________________________________
engine-users mailing list
engine-users@lists.rails-engines.org
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

Reply via email to