ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> rubyonrails-talk
rubyonrails-talk
[Rails] self. vs. @
by Joshua Kolden other posts by this author
Aug 13 2007 11:11AM messages near this date
[Rails] Re: Moving a record | [Rails] Re: self. vs. @
I'm working on an application that creates a confirmation e.mail
whenever you create and account or change an e.mail address.  I
thought I'd just use the same key generation code used for the
password hash login example from the Agile Rails book.

The function to create a salt value keeps failing complaining I have a
nil object where I don't expect it.

The code where it breaks is:

def create_new_salt
    self.salt = @user_id.to_s + rand.to_s
end

I've also put a constant string assigned to self.salt, but the error
still occurs, as if self.salt points to a nil object, but I don't see
how that can happen.  I also don't understand any reason for this
function to call self.salt, instead of @salt.  Any clues would be much
appreciated.

Thanks,
j

PS here is the table definition for this model.

:created_at, :timestamp
:email, :string
:type, :string  #which of several e.mail columns in 'user' does this
change apply to
:user_id, integer
:key, :string #randomly generated key
:salt, :string


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta
lk" group.
To post to this group, send email to rubyonrails-talk@[...].com
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@[...].com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thread:
Joshua Kolden
Eric Anderson
Joshua Kolden
Eric Anderson
Vishnu Gopal
Joshua Kolden
Vishnu Gopal
Joshua Kolden

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved