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 Cheung <
[EMAIL PROTECTED]> wrote:

>
>
>
> 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
>
> >
> > 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 Wed, Nov 26, 2008 at 9:44 PM, Sean McGilvray <[EMAIL PROTECTED]
> >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" <[EMAIL PROTECTED]> 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 <
> [EMAIL PROTECTED]
> > > >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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to