Use authlogic...
On Jun 5, 9:58 am, Petan Cert <[email protected]>
wrote:
> Hi all,
>
> I am using rails v.2.3.2 and if I put following line to my
> ApplicationController:
>
> include LoginSystem
>
> and I moved my login_system.rb to lib folder:
>
> module LoginSystem
> protected
>
> def is_logged_in?
> @logged_in_user = User.find(session[:user]) if session[:user]
> end
>
> def logged_in_user
> return @logged_in_user if is_logged_in?
> end
>
> def logged_in_user=(user)
> if !user.nil?
> session[:user] = user.id
> @logged_in_user = user
> end
> end
>
> def self.included(base)
> base.send :helper_method, :is_logged_in?, :is_admin?,
> :logged_in_user
> end
> end
>
> This does work under RAILS 2.1.1, but not under 2.3.2
> It says: undefined method `is_logged_in?' for
> #<ActionView::Base:0x78cf044>
>
> Cheers
> P.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---