Hi all, i''m a bigginer in rails, i used before a j2ee there was a method request.getParameterValues(param_name) that return array of parameters values than have the same name is there like that method in rails Thanks M.SH -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24.02.2012, at 0:20, M.SH wrote:> Hi all, > i''m a bigginer in rails, i used before a j2ee > there was a method > request.getParameterValues(param_name) > that return array of parameters values than have the same name > > is there like that method in railsWhat exactly do you mean ''the same name'' ? In Rails we have request.path_parameters - the Hash of parameters generating a url actually, like :controller, :action, :host, :subdomain, :id or any other due to your routing settings. ex.: http://yoursite.com/articles/1 (:host => ''yoursite.com'', :controller => ''articles'', :action => ''show'', :id => ''1'') request.query_parameters - the Hash of additional parameters, it can be whatever. ex. :http://yoursite.com/articles&q="love" (:q => ''love'') combined accessor ''params'' - the Hash of all parameters. Since it Hash, there is no duplicate keys. Each key is uniq, but the values individual. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On Thu, Feb 23, 2012 at 12:34 PM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>> request.getParameterValues(param_name) >> that return array of parameters values than have the same name> What exactly do you mean ''the same name'' ?Exactly what he said -- the same name. This: http://example.com/?foo=bar&foo=baz&foo=xyz :: is a perfectly valid URL and easily processed in a Java web app.> combined accessor ''params'' - the Hash of all parameters. > > Since it Hash, there is no duplicate keys. Each key is uniq, but the values individual.Yeah, I''ve never understood that choice. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On 24.02.2012, at 0:48, Hassan Schroeder wrote:> Exactly what he said -- the same name. > > This: http://example.com/?foo=bar&foo=baz&foo=xyzUnacceptable :) Rails'' approach: each key is unique. If you want to get them grouped, just wrap them to array, and your params accessor will be like: {:foo => [''bar'',''bad'',''xyz'']}> > Yeah, I''ve never understood that choice. >Philosophy. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thank u for your reply, i mean by name like <form .. <input type="text" name="street"> <input type="text" name="street"> . . </from> i don''t know the no. of elements <input> On Feb 23, 10:34 pm, Valery Kvon <adda...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 24.02.2012, at 0:20, M.SH wrote: > > > Hi all, > > i''m a bigginer in rails, i used before a j2ee > > there was a method > > request.getParameterValues(param_name) > > that return array of parameters values than have the same name > > > is there like that method in rails > > What exactly do you mean ''the same name'' ? > > In Rails we have > > request.path_parameters - the Hash of parameters generating a url actually, like :controller, :action, :host, :subdomain, :id or any other due to your routing settings. ex.:http://yoursite.com/articles/1(:host => ''yoursite.com'', :controller => ''articles'', :action => ''show'', :id => ''1'') > > request.query_parameters - the Hash of additional parameters, it can be whatever. ex. :http://yoursite.com/articles&q="love" (:q => ''love'') > > combined accessor ''params'' - the Hash of all parameters. > > Since it Hash, there is no duplicate keys. Each key is uniq, but the values individual.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On Thu, Feb 23, 2012 at 12:54 PM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Rails'' approach: each key is unique.> Philosophy.Counter-philosophy -- Be liberal in what you accept, and conservative in what you send. (Postel''s Law) Silently discarding data from a client is not, to my mind, a good thing. To the OP: the answer is "no" :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 February 2012 21:18, M.SH <shehata.mohammed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> thank u for your reply, > i mean by name like > > <form .. > <input type="text" name="street"> > <input type="text" name="street">use <input type="text" name="street[]"> <input type="text" name="street[]"> and I think you will get them as an array in params[:street] Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
thanks for all but Colin is the right answer for me i have try it Colin ++ :) On Feb 23, 11:33 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 February 2012 21:18, M.SH <shehata.moham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > thank u for your reply, > > i mean by name like > > > <form .. > > <input type="text" name="street"> > > <input type="text" name="street"> > > use > <input type="text" name="street[]"> > <input type="text" name="street[]"> > and I think you will get them as an array in params[:street] > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.