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@googlegroups.com.
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.

Search Discussions

  • Valery Kvon at Feb 23, 2012 at 8:35 pm

    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@googlegroups.com.
    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.
  • Hassan Schroeder at Feb 23, 2012 at 8:48 pm

    On Thu, Feb 23, 2012 at 12:34 PM, Valery Kvon 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@gmail.com
    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@googlegroups.com.
    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.
  • Valery Kvon at Feb 23, 2012 at 8:54 pm

    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=xyz
    Unacceptable :)

    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@googlegroups.com.
    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.
  • Hassan Schroeder at Feb 23, 2012 at 9:25 pm

    On Thu, Feb 23, 2012 at 12:54 PM, Valery Kvon 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@gmail.com
    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@googlegroups.com.
    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.
  • M.SH at Feb 23, 2012 at 9:18 pm
    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 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@googlegroups.com.
    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.
  • Colin Law at Feb 23, 2012 at 9:34 pm

    On 23 February 2012 21:18, M.SH 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@googlegroups.com.
    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.
  • M.SH at Feb 23, 2012 at 10:00 pm
    thanks for all
    but Colin is the right answer for me
    i have try it Colin ++ :)
    On Feb 23, 11:33 pm, Colin Law wrote:
    On 23 February 2012 21:18, M.SH 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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 23, '12 at 8:20p
activeFeb 23, '12 at 10:00p
posts8
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase