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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try session[:firstname] = firstname; Hope that helps. http://www.jim-rants.com/coding-blog/ On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray <smcgilvray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > 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 > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try > > session[:firstname] = firstname; > > Hope that helps. > > http://www.jim-rants.com/coding-blog/ > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > > > 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--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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<nayakk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilvray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > 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? > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Try > > > > session[:firstname] = firstname; > > > > Hope that helps. > > > > http://www.jim-rants.com/coding-blog/ > > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >wrote: > > > > > > > > > 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 > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 26, 5:32 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 youWhy add that method when there''s already a values_at method that does exactly that ? Fred> > 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<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > > > 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? > > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Try > > > > session[:firstname] = firstname; > > > > Hope that helps. > > > >http://www.jim-rants.com/coding-blog/ > > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray <smcgilv...-Re5JQEeQqe8@public.gmane.orgm > > >wrote: > > > > > 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--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 smcgilvray-C6gt8ZI8z3bIY2DP0bkpxA@public.gmane.org http://www.transferhome.net On Wed, Nov 26, 2008 at 10:18 AM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Nov 26, 5:32 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > > > > > 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<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >wrote: > > > > > > > > > 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? > > > > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Try > > > > > > session[:firstname] = firstname; > > > > > > Hope that helps. > > > > > >http://www.jim-rants.com/coding-blog/ > > > > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray < > smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > >wrote: > > > > > > > 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 > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Wed, Nov 26, 2008 at 11:51 PM, Sean McGilvray <smcgilvray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> 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 > smcgilvray-C6gt8ZI8z3bIY2DP0bkpxA@public.gmane.org > http://www.transferhome.net > > > > On Wed, Nov 26, 2008 at 10:18 AM, Frederick Cheung < > frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> >> >> On Nov 26, 5:32 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >> >> > >> > 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<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> > >> > On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> >wrote: >> > >> > >> > >> > > 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? >> > >> > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > > > Try >> > >> > > > session[:firstname] = firstname; >> > >> > > > Hope that helps. >> > >> > > >http://www.jim-rants.com/coding-blog/ >> > >> > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray < >> smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> > > >wrote: >> > >> > > > > 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 >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you Sean McGilvray & Sarena Byers Executive Director Identity Theft Specialist Pre-Paid Legal Service''s, Inc. NYSE:PPD Phone: 760-486-1019 smcgilvray-C6gt8ZI8z3bIY2DP0bkpxA@public.gmane.org http://www.transferhome.net On Wed, Nov 26, 2008 at 10:26 AM, NAYAK <nayakk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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) > > Regards, > NAYAK > > On Wed, Nov 26, 2008 at 11:51 PM, Sean McGilvray <smcgilvray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> 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 >> smcgilvray-C6gt8ZI8z3bIY2DP0bkpxA@public.gmane.org >> http://www.transferhome.net >> >> >> >> On Wed, Nov 26, 2008 at 10:18 AM, Frederick Cheung < >> frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> >>> >>> >>> On Nov 26, 5:32 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >>> >>> > >>> > 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<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> > >>> > On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> >wrote: >>> > >>> > >>> > >>> > > 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? >>> > >>> > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > > > Try >>> > >>> > > > session[:firstname] = firstname; >>> > >>> > > > Hope that helps. >>> > >>> > > >http://www.jim-rants.com/coding-blog/ >>> > >>> > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray < >>> smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> > > >wrote: >>> > >>> > > > > 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 >>> >>> >> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 26, 6:26 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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> Regards, > NAYAK > > On Wed, Nov 26, 2008 at 11:51 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > 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 > > smcgilv...-C6gt8ZI8z3bIY2DP0bkpxA@public.gmane.org > >http://www.transferhome.net > > > On Wed, Nov 26, 2008 at 10:18 AM, Frederick Cheung < > > frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> On Nov 26, 5:32 pm, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > > >> > 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<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > >> > On Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <smcgilv...-Re5JQEeQqe8@public.gmane.orgm > >> >wrote: > > >> > > 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? > > >> > > On Nov 26, 8:11 am, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > > > Try > > >> > > > session[:firstname] = firstname; > > >> > > > Hope that helps. > > >> > > >http://www.jim-rants.com/coding-blog/ > > >> > > > On Wed, Nov 26, 2008 at 11:04 AM, Sean McGilvray < > >> smcgilv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >> > > >wrote: > > >> > > > > 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--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---