I am using the ACL System that is described on the Rails wiki and I have a quick question. I want to set the "role" as a session variable so that I can display certain navigation schemes and I was doing it like this: @session[:user][:role] = @user.roles When I print out this variable I get: #<Role:0x3262d80> How can I turn this into a readable value? I tried .to_i because I think it is an integer but that method isn''t valid. Thanks. Seth -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060316/30f8f760/attachment-0001.html
I don''t know that system, but from the code it looks like @user.roles is a collection so you cannot simply print its value On 3/16/06, Buntin, Seth - KATE <Seth.Buntin@coe.murraystate.edu> wrote:> > I am using the ACL System that is described on the Rails wiki and I have > a quick question. I want to set the "role" as a session variable so that I > can display certain navigation schemes and I was doing it like this: > > > > @session[:user][:role] = @user.roles > > > > When I print out this variable I get: > > > > #<Role:0x3262d80> > > > > How can I turn this into a readable value? I tried .to_i because I think > it is an integer but that method isn''t valid. > > > > Thanks. > > Seth > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060316/e17074bf/attachment.html
Buntin, Seth - KATE wrote:> #<Role:0x3262d80> > > > > How can I turn this into a readable value? I tried .to_i because I > think it is an integer but that method isn?t valid.If there''s anything useful in there, @user.roles.inspect might show it. Then again, it might not. More useful I often find (as a check rather than as a presentation method) is YAMP::dump(obj). -- Alex
Yeah I figured that out....i need sleep. _____ From: Emin Hasanov [mailto:emin@hasanov.com] Sent: Thursday, March 16, 2006 3:10 PM To: rails@lists.rubyonrails.org Subject: Re: [Rails] ACLSystem and session variables I don''t know that system, but from the code it looks like @user.roles is a collection so you cannot simply print its value On 3/16/06, Buntin, Seth - KATE <Seth.Buntin@coe.murraystate.edu> wrote: I am using the ACL System that is described on the Rails wiki and I have a quick question. I want to set the "role" as a session variable so that I can display certain navigation schemes and I was doing it like this: @session[:user][:role] = @user.roles When I print out this variable I get: #<Role:0x3262d80> How can I turn this into a readable value? I tried .to_i because I think it is an integer but that method isn''t valid. Thanks. Seth _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060316/6863f71a/attachment.html