Forum: Ruby on Rails Data access problem in object when using acts_as_authenticat

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.
Eed3ca2591560a2dd91222d9b62f882d?d=identicon&s=25 Ryan Prins (Guest)
on 2006-04-21 06:51
(Received via mailing list)
Hi all,

I'm running into this frustrating issue with the acts_as_authenticated
plugin and one of the additional fields I added to the users table.

I have added a column 'account_type' to the users table (among several
others) which denotes the type of account it is. This stores an integer
value that is set by the system during account creation. The value is
getting set correctly and I can see that it is in fact correct when I
query
on it directly in the database. So, that's not my problem. Where my
problem
comes in is when the current_user object gets set with the data from
that
table.

When I drop a debug(current_user) into the view I see this:
"account_type:
1" (quotes added are mine). So, it appears that my account type is not
being
returned, but the rest of the other additional fields that I have
created
return just fine. It is just this one that is throwing the whole thing
off.
Now, when I do:

                <% test123 = User.find(current_user.id.to_s) rescue 0
-%>

                <%= debug(test123) %>

the correct account_type is returned and it is displayed in the debug
block
as account_type: "2"

I have also taken the step of taking the above find and setting the
current_user to that object, but to no avail. So, I'm really stumped on
why
this is happening. Anybody have any experience with this or any clues on
why
this is happening? I understand what the rest of the plug in is doing,
but
this one part is really throwing me off.

Also, slightly unrelated... what do the values in quotes in a debug mean
versus the ones that don't? Example being:

            city: qazx
            address_line1: "1234"

Thanks in advance,
Ryan
Eed3ca2591560a2dd91222d9b62f882d?d=identicon&s=25 Ryan Prins (Guest)
on 2006-04-21 23:08
(Received via mailing list)
Apologies for the "bump", but I'm curious if anybody has had this issue
before or knows of a resolution.

Thanks in advance!

Ryan
This topic is locked and can not be replied to.