Passing form information

Hello everyone I am new to RoR and I was wanting to know how to pass
form information (first_name, last_name, phone_number, and email) to a
session so that I can use them in another form later?

Thank you

Try

session[:firstname] = firstname;

Hope that helps.

http://www.jim-rants.com/coding-blog/

Can I go session[:prospect] = params
[:first_name, :last_name, :email, :phone_number]

Will this put them all in one session and allow me to pull them from
that session later?

Hi Sean,

By default, you can use the hash either use the whole Hash or value of
one
key at a time to store and retrieve in another Hash
But you can add this to your class to open HashWithIndifferentAccess and
add
“values” method for you

class HashWithIndifferentAccess
def values(*indices)
hash = {}
indices.each {|i| hash[i] = self[i]}
p hash
hash
end
end

#Example
a = {}
a[:a] = 1
a[:b] = 2
a[:c] = 3
a[:d] = 4
a[:e] = 5

b = a.values(:a, :b)#{:a=>1, :b=>2}
Please let me know if you have a doubts using the same

Regards,
NAYAK[email protected]

On Nov 26, 5:32 pm, NAYAK [email protected] wrote:

Hi Sean,

By default, you can use the hash either use the whole Hash or value of one
key at a time to store and retrieve in another Hash
But you can add this to your class to open HashWithIndifferentAccess and add
“values” method for you

Why add that method when there’s already a values_at method that does
exactly that ?

Fred

How does the values_at method work?

Sean McGilvray & Sarena Byers
Executive Director
Identity Theft Specialist
Pre-Paid Legal Service’s, Inc. NYSE:PPD
Phone: 760-486-1019
[email protected]
http://www.transferhome.net

On Wed, Nov 26, 2008 at 10:18 AM, Frederick C. <

Thank you

Sean McGilvray & Sarena Byers
Executive Director
Identity Theft Specialist
Pre-Paid Legal Service’s, Inc. NYSE:PPD
Phone: 760-486-1019
[email protected]
http://www.transferhome.net

On Nov 26, 6:26 pm, NAYAK [email protected] wrote:

Hi,

values_at method does not do the same as it returns a array and hence we
cannot restore the values in a hash for later purposes
BTW values_at can be used as
a.values_at(:a, :b)

Oops, getting mixed up here. The method I meant was slice (which is a
rails addition). If you do add a method, I wouldn’t call it values, as
that would overwrite the usual values method which might cause
problems further down the line.

Fred

Hi,

values_at method does not do the same as it returns a array and hence we
cannot restore the values in a hash for later purposes
BTW values_at can be used as
a.values_at(:a, :b)

Regards,
NAYAK