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
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
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 nameis 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.
On Thu, Feb 23, 2012 at 12:34 PM, Valery K. [email protected] 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 S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
thank u for your reply,
i mean by name like
i don’t know the no. of elements
On 23 February 2012 21:18, M.SH [email protected] wrote:
thank u for your reply,
<form ..
i mean by name like
use
and I think you will get them as an array in params[:street]
Colin
On 24.02.2012, at 0:48, Hassan S. wrote:
Exactly what he said – the same name.
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.
On Thu, Feb 23, 2012 at 12:54 PM, Valery K. [email protected] 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 S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
thanks for all
but Colin is the right answer for me
i have try it Colin ++
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs